目的: 如上图所示,在界面左侧有一个MAIN VIEW CONTROLLER,点击其中的一个按钮之后,会显示TAB BAR VIEW的其中一个界面
操作步骤:
1. 将TAB BAR VIEW拖入到Storyboard中;
2. 新建一个类QRTabViewController,注意该类继承UITabBarController,而不是UIViewController!
3. 单击选中Tab View Controller,在右侧"show the identity inspector" ->Custom Class -> 选择上一步新建的QRTabViewController
4. 在Show the Attributes inspector ->View Controller -> Identifier -> 给该tab view取一个唯一标示符,比如"QRTabCodeView"
5. 选中MainViewController,单击顶部菜单的Editor -> Embed in ->Navigation Controller
类似按钮单击之后的代码为:
- (IBAction)langEnglish:(id)sender {
QRTabViewController *secondView = [self.storyboard instantiateViewControllerWithIdentifier:@"QRTabCodeView"];
//第5步中main view嵌入navigation controller的意义在此
[self.navigationController pushViewController:secondView animated:YES];
}