让我解释。我有多个UIViewControllers. 在我的 3 上MainPageController,我有 3 个 UIView。让我们这样枚举:第一个 UIView 被调用LoginView,第二个被调用HomeView,另一个被调用RegView。现在HomeView,有多个按钮会通向其他UIViewControllers. 例如,一个按钮将导致StoreController. 现在,如果我在里面StoreController并且想回到MainPageController,我只需调用:
[self dismissModalViewControllerAnimated:YES completion:nil]
这将把我送回HomeView.
那很好。但是,在 内部StoreController,有一些按钮可以将我定向到LoginView或RegView,无论哪个按钮被点击。问题是当方法时[self dismissModalViewControllerAnimated:YES completion:nil],它只会带我回到HomeView,无论我按下哪个按钮。
dismissModalViewControllerAnimated那么一旦被调用,我将如何显示正确的 UIView呢?
编辑:
这就是我显示 UIViews 的方式:
-(void)viewDidLoad
{
//Initialize the views here...
}
-(void)showViewByTag:(NSInteger)tag
{
if (tag == 1)
{
[self.view addSubview:loginView];
}
else if (tag == 2)
{
[self.view addSubview:homeView];
}
else
{
[self.view addSubview:regView];
}
}
现在我showViewByTag:在代码中的某处调用该方法来显示视图。