ios – presentModalViewController:不推荐使用动画

前端之家收集整理的这篇文章主要介绍了ios – presentModalViewController:不推荐使用动画前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我在XCode中收到警告:
'presentModalViewController:animated:' is deprecated: first deprecated in iOS 6.0

在这行代码:@H_404_5@

[self presentModalViewController:initialSettingsVC animated:YES];

我试图用documentation中的建议替换它:@H_404_5@

[self presentModalViewController:initialSettingsVC animated:YES completion:nil];

我现在在XCode中收到错误:@H_404_5@

No visible @interface for ‘ViewController’ declares the selector
‘presentModalViewController:animated:completion:’@H_404_5@

有任何想法吗?@H_404_5@

解决方法

使用以下……..
if ([self respondsToSelector:@selector(presentViewController:animated:completion:)]){
    [self presentViewController:test animated:YES completion:nil];
} else {
    [self presentModalViewController:test animated:YES];
}

我找到了Here@H_404_5@

猜你在找的iOS相关文章