我有一个带有通过模型视图控制器调用的菜单的 tabBar 应用程序。然后当你选择一个选项。我希望它在更改 tabBAr 的 SelectedIndex 时关闭。
这是我的代码片段:
FirstTabBarController:
这就是所谓的“菜单”
-(IBAction)pressedButton {
GWDNativeViewController *secondView = [[GWDNativeViewController alloc] initWithNibName:nil bundle:nil];
[secondView setModalTransitionStyle:UIModalTransitionStyleCoverVertical];
[self presentModalViewController:secondView animated:YES];
}
这是在 GWDNativeViewController(菜单)视图中关闭的代码:
-(IBAction)dismissThisView {
//Insert code to dismiss here
[self dismissModalViewControllerAnimated:YES];
[(UITabBarController *)self.parentViewController setSelectedIndex:3];
}
该行:
[(UITabBarController *)self.parentViewController setSelectedIndex:3];
似乎没有做的伎俩..