我使用以下代码以模态方式呈现视图控制器.我已将演示风格更改为"当前上下文".它在iOS 8上工作正常,但在os <8时屏幕变黑.我知道Over Current Context仅在iOS 8中可用.我的问题是如何在iOS 7中实现这一点.
let vc = self.storyboard.instantiateViewControllerWithIdentifier("markerView") as! MarkerViewController
Run Code Online (Sandbox Code Playgroud)
self.presentViewController(vc, animated: false, completion: nil)
Chr*_*örz 16
你必须使用Current ContextiOS 7.
要检查您可以使用的iOS版本NSFoundationVersionNumber.
let iOS7 = floor(NSFoundationVersionNumber) <= floor(NSFoundationVersionNumber_iOS_7_1)
let iOS8 = floor(NSFoundationVersionNumber) > floor(NSFoundationVersionNumber_iOS_7_1)
Run Code Online (Sandbox Code Playgroud)
然后,您可以检查正在运行的版本并使用OverCurrentContext或CurrentContext.
if iOS8 {
self.modalPresentationStyle = UIModalPresentationStyle.OverCurrentContext
} else {
self.modalPresentationStyle = UIModalPresentationStyle.CurrentContext
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
17064 次 |
| 最近记录: |