[英]How to go from one view controller to another view controller through tab bar controller when Click a button in the first view controller
I am developing one i pad application using story board.In my storyboard i have tab bar controller and another 4 view controllers are connected to tab bar controller are tab items.I have one button in the first view controller.If i click that button i need to display 4th view controller.If i give a direct segue from first view controller to 4th view controller using 我正在使用故事板开发一个ipad应用程序。在我的故事板中,我有一个选项卡栏控制器,另外四个连接到选项卡栏控制器的视图控制器是选项卡项目。我在第一个视图控制器中有一个按钮。如果我单击该按钮,需要显示第四个视图控制器。如果我使用第一个视图控制器直接向第四个视图控制器发出命令
[self performSegueWithIdentifier:@"SegueIdentifier" sender:nil];
the 4th view controller is appeared but the tab bar display at the bottom is disappear. 出现第四个视图控制器,但底部的标签栏显示消失。
You need to do something like this when the button is pressed... 按下按钮时,您需要执行以下操作...
[self.tabBarController setSelectedIndex:3];
This will tell the tab bar controller to change the selected tab. 这将告诉标签栏控制器更改选定的标签。
Try use it-> 尝试使用它->
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
if ([segue.identifier isEqualToString:@"SegueIdentifier"]) {
[self.tabBarController setSelectedIndex:3];
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.