Spa*_*ero 19 iphone cocoa-touch ios ios5 ios6
我正在使用iOS 6.我的应用程序有一个嵌入了CustomViewController的标准导航控制器.在这个控制器中,我创建了一个这样的模态视图:
-(IBAction)presentModalList:(id)sender {
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle:nil];
StationsListViewController *list = [storyboard instantiateViewControllerWithIdentifier:@"StationsListViewController"];
[list setStationsData: [self.stationsData allValues]];
[self presentModalViewController:list animated:YES];
}
Run Code Online (Sandbox Code Playgroud)
模态控制器显示完美,但解雇会产生警告.该控制器中的消除方法是:
-(IBAction)backToMap
{
[self dismissModalViewControllerAnimated:YES];
}
Run Code Online (Sandbox Code Playgroud)
生成的警告是警告:
在演示或解雇正在进行时,尝试从视图控制器<UINavigationController:0x1ed91620>中解除!
关于那个的任何线索?
谢谢
JDx*_*JDx 28
我意识到这是一个迟到的答案,但也许这会帮助其他人寻找解决方案,这就是我做的:
-(IBAction)backToMap
{
if (![[self modalViewController] isBeingDismissed])
[self dismissModalViewControllerAnimated:YES];
}
Run Code Online (Sandbox Code Playgroud)
对我来说,我发现这行代码被多次调用,我无法找到原因,所以这是最简单的修复.
Kyl*_*egg 14
感谢JDx让我走上正轨.我对其进行了调整以形成此解决方案,该解决方案将在不使用iOS 6中不推荐使用的功能的情况下删除警告:
-(IBAction)backToMap
{
if (![self.presentedViewController isBeingDismissed]) {
[self dismissViewControllerAnimated:YES completion:^{}];
}
}
Run Code Online (Sandbox Code Playgroud)
针对 iOS6,这对我有用:
if (![self.presentedViewController isBeingDismissed])
[self.presentedViewController dismissViewControllerAnimated:YES
completion:nil];
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
21003 次 |
最近记录: |