[英]Custom Delegate in UINavigationController calling from subview
I have a UINavigationController which is presented in a Modal view. 我有一个模态视图中显示的UINavigationController。 I want the view which is presenting the navigationcontroller to be responsible for removing the modal. 我希望呈现导航控制器的视图负责删除模态。 Therefor I created a delegate method on the UINavigationController: 为此,我在UINavigationController上创建了一个委托方法:
@protocol MyNaviDelegate <NSObject>
-(void)userWantsToQuit;
@end
How can I call this delegate method from a subview (lets say if the user is 2 levels deep into the navigationcontroller (like VIEW C)? 我如何从子视图中调用此委托方法(如果用户位于导航控制器深处为2级(例如VIEW C))?
---------------------------------------------------------
| NAVIGATION CONTROLLER |
| -------------- -------------- -------------- |
| | VIEW A | -> | VIEW B | -> | VIEW C | |
| | | | | | | |
| -------------- -------------- -------------- |
| |
---------------------------------------------------------
Thanks in advance! 提前致谢!
You can send Notification on a particular event(from View C) to that controller class in which you are presenting the navigationcontroller. 您可以将特定事件的通知(从View C)发送到要在其中显示navigationcontroller的控制器类。 Then you can remove it. 然后,您可以将其删除。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.