【发布时间】:2012-03-05 22:25:01
【问题描述】:
我再次回到我的第一个 Apps VC 时遇到问题,第一个“屏幕/ViewController)”是一个登录屏幕,然后当我处于某个级别时,我使用它们各自的 ViewController 调用 UITabbar一个 ViewController(例如第 5 个)我想在我的应用程序中获得“注销”行为并返回到第一个 ViewController(登录)。但我想我只能导航回我的 Tabbar 控件的第一个 ViewController。我正在尝试使用我的 VC 的这种方法:
this.NavigationController.PopToViewController(previousVC,true); 或者 this.NavigationController.PopToRootViewController(true);
任何帮助将不胜感激。
(如果您需要有关代码的更多详细信息,请告诉我)
//Call to the tab bar from the login viewcontroller
mainTBC = new TabBarMenuPpal ();
this.NavigationController.PushViewController (mainTBC, true);
…
//Tabbarmenuppal with a set of navcontrollers
public TabBarMenuPpal ()
{
var customerVC = new Customers ();
navCustomers = new UINavigationController ();
navCustomers.PushViewController (customerVC, true);
navCustomers.TopViewController.Title = customersTitle;
navCustomers.TabBarItem = new UITabBarItem (customersTitle, UIImage.FromFile ("Utility/Images/Cust-30x30.png"), 0);
…
mainVC = new UIViewController[]
{
navCustomers
, navSettings
} ;
this.ViewControllers = mainVC;
}
问题是当我开始在 navCustomers 中导航时,我找不到返回登录 VC 的方法(删除我的标签栏并释放所有资源)。 (对不起我的英语)。
【问题讨论】:
-
您能显示您的特定设置的代码吗?你使用的是 UITabBarController 还是 UINavigationController?
-
一般来说,您可能需要在 AppDelegate 上公开一个方法,该方法将清理选项卡、导航栏和视图,然后显示您的登录 UI。
标签: ios uiviewcontroller xamarin.ios uitabbar