【问题标题】:Getting MonoTouch Navigation Depth获取 MonoTouch 导航深度
【发布时间】:2014-09-04 20:31:17
【问题描述】:

我正在使用各种这些命令来导航我的应用程序:

NavigationController.PushViewController( ... );
NavigationController.PopViewControllerAnimated( ... );

在我的应用程序中,它可能会四处游荡并深入了解推送的视图控制器。我想在深度超过 15-20 层时弹出一条消息。我可以添加自己的计数器,但有没有办法确定导航控制器堆栈的深度?

【问题讨论】:

    标签: ios xamarin.ios xamarin


    【解决方案1】:

    找到我的答案

    public override void ViewWillAppear(bool animated) {
        base.ViewWillAppear( animated );
    
        int DEPTH = NavigationController.ViewControllers.Count();
        if ( DEPTH > 15 ) {
            MessageManager.MessageBox("Warning: You have navigated " 
                   + DEPTH 
                   + " levels forward into the model.  Navigating too many levels can be confusing for many users.");
        }
    }
    

    【讨论】:

      猜你喜欢
      • 2013-06-20
      • 2015-06-26
      • 2020-04-11
      • 2014-03-03
      • 2015-07-16
      • 2021-08-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多