【发布时间】:2020-08-15 12:59:47
【问题描述】:
在我的项目中,您可以从模态视图创建帖子。
当模式视图被关闭(用户按下保存帖子)时,我想将标签栏控制器切换到第二个标签(帖子提要屏幕)。
这个话题与我的问题类似。唯一的区别是这是从模态视图中呈现的。我不知道如何在我的代码中实现它(标签栏为零) Switch tab bar programmatically in Swift
我添加了 3 张图片以使这个问题更清楚
@objc func saveAction(sender: UIButton) {
print ("> save pressed")
print(presentingViewController?.tabBarController)
print(presentingViewController)
presentingViewController?.tabBarController?.selectedIndex = 1
dismiss(animated: true)
}
编辑:抱歉堆栈溢出不允许我添加图像
【问题讨论】:
标签: swift uinavigationcontroller modal-dialog uitabbarcontroller uitabbar