我是 IOS 的新手,下面是我的应用程序结构的屏幕截图 -
有各种连接到标签栏 Controller 的 tableViewcontroller/uiviewcontroller - 我猜都是非常标准的。
彩色照片是主页 - 我希望用户能够单击 4 个选项卡之一并导航到其他页面之一 - 尽管我正在努力研究如何以编程方式进行此操作。
我已将所有按钮附加为 ib-actions 并提供了所有屏幕 Storyboard ID。
到目前为止,以下是我的代码 -
- (IBAction)btnCult:(id)sender {
UIViewController *vc = [self.storyboard instantiateViewControllerWithIdentifier:@"culture"];
[self presentViewController:vc animated:YES completion:nil];
}
这什么也没做 - 我哪里出错了?
最佳答案
尝试将其添加到 IBAction 中:
[self.tabBarController setSelectedIndex:0];
它应该带您到第一个选项卡,通过更改索引您可以更改选项卡( View )
关于ios - 在 iOS 上以编程方式切换到备用 ViewController,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22227071/