编辑(2015年11月16日)
我从下面的这个线程复制我的答案:
此答案在iOS 8.3+和iOS 8的早期版本中均无效。我不建议任何人使用它,特别是因为不能保证在将来的iOS版本中都可以使用它。
我的新解决方案使用的标准
presentViewController方法
UIViewController。我初始化
UIViewController,将自定义模态添加
View为的子视图
UIViewController,然后选择
View使用约束定位模态。奇迹般有效!
原始答案
遵循Anna的建议,我使用a
UIWindow代替了
UIView.Here,这是我的新代码:
var modalWindow:UIWindow = UIWindow(frame: self.view.window!.bounds)modalWindow.backgroundColor = UIColor.blackColor().colorWithAlphaComponent(0.66)modalWindow.hidden = falsemodalWindow.windowLevel = (UIWindowLevelStatusBar + 1)modalWindow.addSubview(customView)modalWindow.makeKeyAndVisible()
现在它可以像以前一样正常工作,除了Apple状态栏上的文本也变暗了。非常感谢您提供的所有帮助!
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)