iOS 关闭模态呈现的导航控制器
iOS dismissing a modally presented Navigation Controller
我这样展示一个导航控制器:
let navController = self.storyboard?.instantiateViewControllerWithIdentifier("myId") as! UINavigationController
self.presentViewController(navController, animated: true, completion: nil)
如何使用从情节提要设置的Navigation Bar Button
关闭这个Navigation Controller
?可能吗?
注意:我 不是 询问如何关闭 VC 的逻辑,我知道 protocol/delegate
模式。相反,我问我是否可以在导航栏中放置一个 "Cancel"
按钮,以及该按钮的 IBAction
是否会在 Navigation Controller
子类或导航控制器的根视图控制器中声明 [=18] =]
UINavigationController
不拥有导航栏按钮项。它由推入堆栈的视图控制器提供。您可以从任何视图控制器的导航栏中关闭 UINavigationController
,前提是它是模态显示的。可以在情节提要中添加 UINavigationBar
并为执行解雇的栏按钮项目添加 IBOutlet
。
我这样展示一个导航控制器:
let navController = self.storyboard?.instantiateViewControllerWithIdentifier("myId") as! UINavigationController
self.presentViewController(navController, animated: true, completion: nil)
如何使用从情节提要设置的Navigation Bar Button
关闭这个Navigation Controller
?可能吗?
注意:我 不是 询问如何关闭 VC 的逻辑,我知道 protocol/delegate
模式。相反,我问我是否可以在导航栏中放置一个 "Cancel"
按钮,以及该按钮的 IBAction
是否会在 Navigation Controller
子类或导航控制器的根视图控制器中声明 [=18] =]
UINavigationController
不拥有导航栏按钮项。它由推入堆栈的视图控制器提供。您可以从任何视图控制器的导航栏中关闭 UINavigationController
,前提是它是模态显示的。可以在情节提要中添加 UINavigationBar
并为执行解雇的栏按钮项目添加 IBOutlet
。