你能帮我吗,我有一个导航栏,有一个后退按钮,当我按下后退按钮时,我想回到我的视图,但不确定这是正确的方式,我正在这样做。
public void Login()
{
cmdLogin.TouchUpInside += delegate {
var rootViewController = new UINavigationController();
LoginViewController LVC = new LoginViewController();
rootViewController.PushViewController(LVC, false);
this._window.RootViewController = rootViewController;
this._window.MakeKeyAndVisible();
_backButton = new UIBarButtonItem("Back", UIBarButtonItemStyle.Bordered, onBackSelected);
LVC.NavigationItem.LeftBarButtonItem = _backButton;
LVC.Title = "Login";
};
}
我的 onBackSelected 看起来像这样。
private void onBackSelected(object o, EventArgs e)
{
_window = new UIWindow (UIScreen.MainScreen.Bounds);
viewController = new CirkelWithButtonsViewController (_window);
_window.RootViewController = viewController;
_window.MakeKeyAndVisible ();
}
我不知道这是否是返回的正确方法?请提供更好的解决方案:)