使用模态跳转,Xcode有时候会出现
Presenting view controllers on detached view controllers is discouraged <SetViewController: 0x7fedb94f0f60>.
这样的警告代码,如果你认为你的层次之间没有问题(其实就是层次问题。present出来的模态窗口,禁止再使用present 来弹出其它的子窗口)
解决方法:
把
WithUsViewController *with=[[WithUsViewController alloc]init]; [self presentViewController:with animated:YES completion:nil];
改为:
AppDelegate *delegate = (AppDelegate *)[UIApplication sharedApplication].delegate; WithUsViewController *with=[[WithUsViewController alloc]init]; [delegate.window.rootViewController presentViewController:with animated:YES completion:^{ }];
即可
时间: 2024-11-08 06:50:48