【发布时间】:2016-10-25 14:49:57
【问题描述】:
【问题讨论】:
标签: swift uiview uinavigationbar uistatusbar
【问题讨论】:
标签: swift uiview uinavigationbar uistatusbar
下面的代码将帮助您。您可以将颜色更改为所需的颜色以达到所需的效果。
UIWindow *window = [[[UIApplication sharedApplication] delegate] window];
UIView *blue = [[UIView alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
[blue setBackgroundColor:[UIColor blueColor]];
[window addSubview: blueView];
Swift 代码:
if let applicationDelegate:AppDelegate = UIApplication.shared.delegate as! AppDelegate? {
if let window:UIWindow = applicationDelegate.window {
let blueView:UIView = UIView(frame: UIScreen.main.bounds)
blueView.backgroundColor = UIColor.blue.withAlphaComponent(0.75)
window.addSubview(blueView)
}
}
【讨论】:
你可能想看看这个人的答案。
How to make a UIView that can cover the navigation bar?
基本上,不是将第二个视图设置为主视图的子视图,而是将第二个视图设置为导航控制器的子视图。
【讨论】: