initWithNibName use partial nib name rather than full nib name

So i want to initialise my view controller with a nib however i don't want to use the full name of the nib just the first four characters as the remaining characters vary.

As you can see below in my code all of my nibs follow a format the format is 1_somenumber_sometext. Somenumber is substituted with xibNumber, xibNumber is a number from 1 to 10 this is calculated seperately and just added into the nib name, no need to worry about it.

NSString* xibName =[NSMutableString stringWithFormat:@"1_%@_sometext", xibNumber];

childController = [[CategoryOneDetailController alloc] initWithNibName:xibName bundle:nil];

Can anyone help me?


If xibNumber is a number (NSInteger or int), replace that %@ with %i. If it is a double or float, use %d or %f. %@ is a token used to signify an object, so it won't work for primitive types like NSInteger or int.

Need Your Help

general purpose Comparator for a TreeMap<Object, T>?

java object tree comparator

I need TreeMap&lt;Object, HGHandle&gt; but my objects are neither Comparable nor is there a common Comparator&lt;Object&gt;.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.