Ios 如何移回viewcontroller?
有3个视图控制器Ios 如何移回viewcontroller?,ios,iphone,ios4,uiviewcontroller,Ios,Iphone,Ios4,Uiviewcontroller,有3个视图控制器View1、View2和View3 从view3我必须导航到view1 我已经尝试了以下代码,但它不起作用 //in View3.m - (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex; { appDelegate.isComingFromCountries = YES; [self dismissViewControllerAnimated:
View1、View2
和View3
从view3
我必须导航到view1
我已经尝试了以下代码,但它不起作用
//in View3.m
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex;
{
appDelegate.isComingFromCountries = YES;
[self dismissViewControllerAnimated:YES completion:nil];
}
//in View2.m
-(void)viewWillAppear:(BOOL)animated
{
if (appDelegate.isComingFromCountries == YES)
{
appDelegate.isComingFromCountries = NO;
[self dismissViewControllerAnimated:YES completion:nil];
}
}
但是这个代码不起作用。如何处理此问题?您可以尝试以下方法:
如果要将一个viewController推到另一个,并希望向后移动,请使用此viewController
[self.navigationController popViewControllerAnimated:YES];
[picker dismissViewControllerAnimated:YES completion:nil];
如果您正在演示viewController,请使用modelly并希望向后移动,然后使用此选项
[self.navigationController popViewControllerAnimated:YES];
[picker dismissViewControllerAnimated:YES completion:nil];
您也可以尝试这样做,因为首先需要关闭第三个viewController,然后关闭第二个viewController
UIViewController *viewController = [self parentViewController];
[self dismissModalViewControllerAnimated:NO];
[viewController dismissModalViewControllerAnimated:YES];
你可以试试这个:
如果要将一个viewController推到另一个,并希望向后移动,请使用此viewController
[self.navigationController popViewControllerAnimated:YES];
[picker dismissViewControllerAnimated:YES completion:nil];
如果您正在演示viewController,请使用modelly并希望向后移动,然后使用此选项
[self.navigationController popViewControllerAnimated:YES];
[picker dismissViewControllerAnimated:YES completion:nil];
您也可以尝试这样做,因为首先需要关闭第三个viewController,然后关闭第二个viewController
UIViewController *viewController = [self parentViewController];
[self dismissModalViewControllerAnimated:NO];
[viewController dismissModalViewControllerAnimated:YES];
你可以试试这个:
如果要将一个viewController推到另一个,并希望向后移动,请使用此viewController
[self.navigationController popViewControllerAnimated:YES];
[picker dismissViewControllerAnimated:YES completion:nil];
如果您正在演示viewController,请使用modelly并希望向后移动,然后使用此选项
[self.navigationController popViewControllerAnimated:YES];
[picker dismissViewControllerAnimated:YES completion:nil];
您也可以尝试这样做,因为首先需要关闭第三个viewController,然后关闭第二个viewController
UIViewController *viewController = [self parentViewController];
[self dismissModalViewControllerAnimated:NO];
[viewController dismissModalViewControllerAnimated:YES];
你可以试试这个:
如果要将一个viewController推到另一个,并希望向后移动,请使用此viewController
[self.navigationController popViewControllerAnimated:YES];
[picker dismissViewControllerAnimated:YES completion:nil];
如果您正在演示viewController,请使用modelly并希望向后移动,然后使用此选项
[self.navigationController popViewControllerAnimated:YES];
[picker dismissViewControllerAnimated:YES completion:nil];
您也可以尝试这样做,因为首先需要关闭第三个viewController,然后关闭第二个viewController
UIViewController *viewController = [self parentViewController];
[self dismissModalViewControllerAnimated:NO];
[viewController dismissModalViewControllerAnimated:YES];
您可以使用
presentingViewController
解除它
试试这个-
[self.presentingViewController.presentingViewController dismissModalViewControllerAnimated:YES];
A->B->C
在模式C中运行上述代码将带您返回A。您可以使用
presentingViewController
解除它
试试这个-
[self.presentingViewController.presentingViewController dismissModalViewControllerAnimated:YES];
A->B->C
在模式C中运行上述代码将带您返回A。您可以使用
presentingViewController
解除它
试试这个-
[self.presentingViewController.presentingViewController dismissModalViewControllerAnimated:YES];
A->B->C
在模式C中运行上述代码将带您返回A。您可以使用
presentingViewController
解除它
试试这个-
[self.presentingViewController.presentingViewController dismissModalViewControllerAnimated:YES];
A->B->C
在模态C中运行上述代码将带您返回到A。如果您从一系列模态显示的视图控制器返回到根视图控制器,则以下代码将在iOS6中工作
[self.window.rootViewController dismissViewControllerAnimated:NO completion:nil];
如果您从一系列模式显示的视图控制器返回到根视图控制器,那么以下代码将在iOS6中工作
[self.window.rootViewController dismissViewControllerAnimated:NO completion:nil];
如果您从一系列模式显示的视图控制器返回到根视图控制器,那么以下代码将在iOS6中工作
[self.window.rootViewController dismissViewControllerAnimated:NO completion:nil];
如果您从一系列模式显示的视图控制器返回到根视图控制器,那么以下代码将在iOS6中工作
[self.window.rootViewController dismissViewControllerAnimated:NO completion:nil];
我想,这可能对你有帮助。根据您的代码(在注释区域),您可以从第一个视图控制器推送第二个视图控制器,然后从第二个视图控制器推送第三个视图控制器。因此,您必须将委托设置为第三位中的第二位。并在第三个VC中执行以下代码
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex;
{
appDelegate.isComingFromCountries = YES;
[self dismissViewControllerAnimated:YES completion:^{
[self.delegate dismissModal];
};
}
在第二个VC.m
-(void)dismissModal
{
[self.navigationController popViewControllerAnimated:NO];
}
我想,这可能对你有帮助。根据您的代码(在注释区域),您可以从第一个视图控制器推送第二个视图控制器,然后从第二个视图控制器推送第三个视图控制器。因此,您必须将委托设置为第三位中的第二位。并在第三个VC中执行以下代码
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex;
{
appDelegate.isComingFromCountries = YES;
[self dismissViewControllerAnimated:YES completion:^{
[self.delegate dismissModal];
};
}
在第二个VC.m
-(void)dismissModal
{
[self.navigationController popViewControllerAnimated:NO];
}
我想,这可能对你有帮助。根据您的代码(在注释区域),您可以从第一个视图控制器推送第二个视图控制器,然后从第二个视图控制器推送第三个视图控制器。因此,您必须将委托设置为第三位中的第二位。并在第三个VC中执行以下代码
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex;
{
appDelegate.isComingFromCountries = YES;
[self dismissViewControllerAnimated:YES completion:^{
[self.delegate dismissModal];
};
}
在第二个VC.m
-(void)dismissModal
{
[self.navigationController popViewControllerAnimated:NO];
}
我想,这可能对你有帮助。根据您的代码(在注释区域),您可以从第一个视图控制器推送第二个视图控制器,然后从第二个视图控制器推送第三个视图控制器。因此,您必须将委托设置为第三位中的第二位。并在第三个VC中执行以下代码
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex;
{
appDelegate.isComingFromCountries = YES;
[self dismissViewControllerAnimated:YES completion:^{
[self.delegate dismissModal];
};
}
在第二个VC.m
-(void)dismissModal
{
[self.navigationController popViewControllerAnimated:NO];
}
您也可以像这样从
视图3
弹出到视图1
:
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex{
[self.navigationController dismissViewControllerAnimated:NO completion:nil];
[self.navigationController dismissViewControllerAnimated:YES completion:nil];
}
您也可以像这样从
视图3
弹出到视图1
:
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex{
[self.navigationController dismissViewControllerAnimated:NO completion:nil];
[self.navigationController dismissViewControllerAnimated:YES completion:nil];
}
您也可以像这样从
视图3
弹出到视图1
:
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex{
[self.navigationController dismissViewControllerAnimated:NO completion:nil];
[self.navigationController dismissViewControllerAnimated:YES completion:nil];
}
您也可以像这样从
视图3
弹出到视图1
:
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex{
[self.navigationController dismissViewControllerAnimated:NO completion:nil];
[self.navigationController dismissViewControllerAnimated:YES completion:nil];
}
您必须使用延迟方法来执行动画,以便主线程应该开始在ViewB控制器中执行
[自执行选择器:@selector(methodForDissmiss)with object:nil afterDelay:0.5]代码>
然后在selector方法中编写Disclose代码,以根据您的逻辑工作。您必须使用delay方法来执行动画,以便主线程应该开始在viewController中执行
[自执行选择器:@selector(methodForDissmiss)with object:nil afterDelay:0.5]代码>
然后在selector方法中编写Disclose代码,以根据您的逻辑工作。您必须使用delay方法来执行动画,以便主线程应该开始在viewController中执行
[自执行选择器:@selector(methodForDissmiss)with object:nil afterDelay:0.5]代码>
然后在selector方法中编写Disclose代码,以根据您的逻辑工作。您必须使用delay方法来执行动画,以便主线程应该开始在viewController中执行
[自执行选择器:@selector(methodForDissmiss)with object:nil afterDelay:0.5]代码>
然后在selector方法中编写Disclose代码,根据您的逻辑工作。如果您使用的是使用[self.navigationController PoptorootViewController Initiated:YES]的Nvigation控制器;我用过这个。CurrentLocationViewController*obj=[[CurrentLocationViewController alloc]init];UINavigationController*navBar=[[UINavigationController alloc]initWithRootViewController:obj];[self.navigationController presentModalViewController:navBar动画:是];[s]