initWithNibName method, can I just use first few characters of nib name
I'm currently initialising a view controller with a nib using 开发者_运维百科initWithNibName
however this method requires the full name of the nib, is it possible to use the first 4 characters rather than the full name.
The reason i would like to do this is because my nibs are named like this nib1_blahblahblah, nib2_blahblahblah, nib3_blahblahblah etc. Where blahblahblah is some text.
Thanks in advance.
If you really want to do that you can define some string constants:
You can then use it like a variable. Either give it a shorter name. Or give it the same name and code completion will take cars of the rest.
For example - in the implementation file:
NSString * const nib1_blahblahblah = @"nib1_blahblahblah";
NSString * const nib2_blahblahblah = @"nib2_blahblahblah";
Is it worth me telling you that better nib names would be a better idea?
精彩评论