开发者

bringSubviewToFront not showing it's view

开发者 https://www.devze.com 2023-01-23 21:52 出处:网络
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>

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).

0

精彩评论

暂无评论...
验证码 换一张
取 消