bringSubviewToFront not showing it's view
In my table view controller, I have a button that when I press, I want it to show the map view, so I just did the following. However, for some reason it's not showing up the view... why is this>
- (void)viewDidLoad {
mapViewController = mapViewController = [[MapViewController alloc] init];
[super viewDidLoad];
}
-(IBAction) toggleAction:(id) sender {
[self.view bringSubviewToFront:mapViewController.view];
开发者_StackOverflow社区 self.navigationItem.backBarButtonItem = nil;
}
You need to add the view as a subview:
-(IBAction) toggleAction:(id) sender {
[self.view addSubView:mapViewController.view];
self.navigationItem.backBarButtonItem = nil;
}
Then remove it on dismissal (removeFromSuperView).
精彩评论