My hierachy controller:
- TabBaseController (UITabBarController)
In my tabbasecontroller, I have a navigation bar button that flips the subclass controller using the presentModalViewController method to the second UITabBarController.
So my question is: why not
self.parentViewController
work in the second UITabBarController? This is zero.
I try this in my viewDidLoad method in the second UITabBarController:
if (self.parentViewController == nil) {
NSLog(@"Parent is nil");
}
UPDATED
This is a method in a UITabBarController with a navigation item that represents it
-(IBAction)openModalTabController:(id)sender {
if (self.nvc == nil) {
ModalTabController *vc = [[ModalTabController alloc] init];
self.nvc = vc;
[vc release];
}
[self presentModalViewController:self.nvc animated:YES];
}
This is the controller (UITabBarController) that I present modally:
Title:
@interface NewBuildingViewController : UITabBarController {
}
@end
Main:
@implementation NewBuildingViewController
- (id)init {
[super initWithNibName:nil bundle:nil];
ViewController1 *vc1 = [[ViewController1 alloc] init];
ViewController2 *vc2 = [[ViewController2 alloc] init];
ViewController3 *vc3 = [[ViewController3 alloc] init];
NSArray *controllers = [[NSArray alloc] initWithObjects:vc1, vc2, vc3, nil];
[vc1 release];
[vc2 release];
[vc3 release];
self.viewControllers = controllers;
[controllers release];
self.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
return self;
}
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
return [self init];
}
@end
I also want to add that this message is displayed in the console (warning) when flipping:
. , .
,