i'm pretty new in the iPhone/iPad developing. In my application i have a uitabcontroller and in one tab, i'll add a uinavigation controller. But I realized that i need the same design and function in other tab, I would like the reuse the code and the only change would be the xml file that the section is using.
Is there anyway to add a parameter in a uinavigation controller for the main view? Thanks in advance.
You could subclass UINavigationController
, add in the common code, and have all your tab's view controllers use this subclass. So, for example, you could do:
@implementation MyNavController : UINavigationController {
NSString *foo;
}
- (id)initWithFoo:(NSString *)aFoo;
@end
And implement initWithFoo
like:
- (id)initWithFoo:(NSString *)aFoo {
if (self = [super init]) { // or whatever init method you want to use for UINavigationController
foo = [aFoo retain];
}
return self;
}
Hope this helps!