开发者

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

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜