ios presentModalViewController:animated 已弃用
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/17047578/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
presentModalViewController:animated is deprecated
提问by poiuytrez
I am getting a warning in XCode:
我在 XCode 中收到警告:
'presentModalViewController:animated:' is deprecated: first deprecated in iOS 6.0
on this line of code:
在这行代码中:
[self presentModalViewController:initialSettingsVC animated:YES];
I tried to replace it as suggested in the documentationwith:
我尝试按照文档中的建议将其替换为:
[self presentModalViewController:initialSettingsVC animated:YES completion:nil];
I now get an error in XCode:
我现在在 XCode 中遇到错误:
No visible @interface for 'ViewController' declares the selector 'presentModalViewController:animated:completion:'
“ViewController”没有可见的@interface 声明选择器“presentModalViewController:animated:completion:”
Any ideas?
有任何想法吗?
回答by Nirav Gadhiya
回答by Ahmed Talaab
Replace
代替
[self presentModalViewController:initialSettingsVC animated:YES completion:nil];
To
到
[self presentViewController:reader animated:YES completion:nil];
回答by Vinzzz
You want to use the following
你想使用以下
- (void)presentViewController:(UIViewController *)viewControllerToPresent
animated: (BOOL)flag completion:(void (^)(void))completion;
settting UIModalPresentationStyle
and UIModalTransitionStyle
for viewController
in order to get the modal animation /presentation you're looking for
setttingUIModalPresentationStyle
和UIModalTransitionStyle
用于viewController
为了得到你要寻找的模式动画/演示