在其他地方导航都很好,只有在这个地方不起作用(它和所有其他Viewmodel一样设置)
我正在尝试从ImportView(ImportViewModel)导航到LoginView(LoginViewModel)。在Buttonclick(ViewModel中的绑定MvxCommand)上,我调用ShowViewModel<LoginViewModel>();
它在工作,但后来整个导航都坏了。如果我现在从新打开的LoginViewModel移动到例如TestViewModel(或TestView),然后现在转到"返回",我不会回到LoginView,而是回到黑屏,还有一个"返回"之后应用程序崩溃。。。(MonoTouch.Foundation.MonoTouchException: Objective-C exception thrown. Name: NSInvalidArgumentException Reason: Can't add self as subview
)
问题在哪里?
以下是一些首次亮相:
[0:] mvx:Warning: 26.41 Don't know how to close this viewmodel - topmost view does not present this viewmodel
[0:]
2013-12-13 13:19:28.400 INMobileAdminUIiOS[6932:60b] mvx:Diagnostic: 26.81 Showing ViewModel LoginViewModel
[0:] mvx:Diagnostic: 26.81 Showing ViewModel LoginViewModel
[0:]
2013-12-13 13:19:28.799 INMobileAdminUIiOS[6932:60b] TouchNavigation:Diagnostic: 27.21 Navigate requested
[0:] TouchNavigation:Diagnostic: 27.21 Navigate requested
2013-12-13 13:19:29.085 INMobileAdminUIiOS[6932:60b] nested push animation can result in corrupted navigation bar
[0:]
2013-12-13 13:19:29.224 INMobileAdminUIiOS[6932:601f] 13.12.2013 13:19:29 TinyMessage: ProgressDialogDismissMessage
[0:] 13.12.2013 13:19:29 TinyMessage: ProgressDialogDismissMessage
2013-12-13 13:19:29.463 INMobileAdminUIiOS[6932:60b] Finishing up a navigation transition in an unexpected state. Navigation Bar subview tree might get corrupted.
我解决了这个问题。
我在viewDidAppear
中添加了this.NavigationController.PopToRootViewController(true);
当视图控制器试图在不等待子视图控制器加载结束的情况下弹出到顶部视图控制器时,就会出现问题。视图出现后必须调用popToRootViewControllerAnimated()
!
我已经解决了这个问题。
我添加了
this.NavigationController.PopToRootViewController(true);
在viewDidAppear
中