我在这个网站上尝试了几个答案,但似乎没有一个与我的问题有关
我有一个MasterDetail应用程序,它有两种类型的segues我正在使用.当您按下详细视图上的按钮时,它会使用推送segue并将另一个详细视图推送到该视图上.在新的detailview(刚推入的那个)中,有一个按钮,它使用模态segue调用另一个UIView(表单).
我所试图做的是当用户选择一排,一个UIAlertView中会出现一个显示的消息,而在同一时间(不一定是在同一时间)解聘的UIViewController的(模式),并返回来自推动的Viewcontroller.基本上,我需要能够解雇所有的viewcontrollers,一个模态和一个push(nav),以便视图返回到他们开始的原始主屏幕.
我有UIAlertView工作正常,我可以通过使用,[self.dismissViewControllerAnimated:YES completion:nil];但我不知道如何解雇下一个Viewcontroller(在导航控制器中)解雇模态viewcontroller .使用此:[self.navigationController popToRootViewControllerAnimated:NO];不起作用.
这是我想要调用函数删除所有视图的地方:
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:urlWithIDAndChallenge];
NSURLConnection *conn = [[NSURLConnection alloc] initWithRequest:request delegate:self];
UIAlertView *message = [[UIAlertView alloc] initWithTitle@"Started" message:@"The challenge has begun!" delegate:nil cancelButtonTitle:@"OK!" otherButtonTitles:nil];
[message show]
//right here is where I would normally dismiss the modal VC
//here is where I would like to dismiss all VC
}
Run Code Online (Sandbox Code Playgroud) cocoa-touch objective-c storyboard uinavigationcontroller ios