ios iOS6 中的presentModalViewController

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/14746407/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-30 22:12:07  来源:igfitidea点击:

presentModalViewController in iOS6

ioscocoa-touchios6

提问by user975561

In my app's code I am still presenting viewcontrollers modally with presentModalViewController. This is deprecated in iOS 6. Does that mean this method has no effect on devices running iOS 6?

在我的应用程序代码中,我仍然使用presentModalViewController 以模态方式呈现视图控制器。这在 iOS 6 中已被弃用。这是否意味着此方法对运行 iOS 6 的设备没有影响?

If yes, how can I make my app present viewcontrollers modally on iOS 6? My Xcode version does not support iOS 6, so all new methods in iOS 6 are unavailable to me.

如果是,如何让我的应用在 iOS 6 上以模态方式呈现视图控制器?我的 Xcode 版本不支持 iOS 6,所以我无法使用 iOS 6 中的所有新方法。

回答by Fabian Kreiser

Deprecated means that you shouldn't use this method anymore. It still works, but it might be completely removed in one of the next updates.

弃用意味着您不应再使用此方法。它仍然有效,但可能会在下一次更新之一中完全删除。

For displaying view controllers modally, you can use the new -presentViewController:animated:completion:method introduced in iOS 5.0.
For dismissing the new method is -dismissViewControllerAnimated:completion:.

要以模态方式显示视图控制器,您可以使用-presentViewController:animated:completion:iOS 5.0 中引入的新方法。
对于解雇新方法是-dismissViewControllerAnimated:completion:

https://developer.apple.com/documentation/uikit/uiviewcontroller

https://developer.apple.com/documentation/uikit/uiviewcontroller

回答by Gajendra K Chauhan

If you have

如果你有

[self presentModalViewController:aController animated:YES];

change it to

将其更改为

[self presentViewController:aController animated:YES completion:nil];