iphone/ipad adding adding and removing a subview doesnt work
- by Mark
Im have a slight amount of trouble adding a new view to my scene, I have the code like this:
- (void) showMyDayView {
NSLog(@"My Day View was touched");
MyDayViewController *temp = [[MyDayViewController alloc] initWithNibName: @"MyDayView" bundle:nil];
self.myDayViewController = temp;
NSLog(@"superview: %@", [[self mainNavView] superview]);
[[self mainNavView] removeFromSuperview];
NSLog(@"after removal main: %@", [self mainNavView]);
NSLog(@"after removal view: %@", [self view]);
NSLog(@"after removal superview: %@", [[self view] superview]);
[[[self view] superview] addSubview: [self.myDayViewController view]];
[temp release];
}
And when I run this code, the console says "after removal superview: (null)"
so when I add the subView to the superview, nothing happens because the superview is null.
Any ideas?
Thanks
Mark