Maison > Questions et réponses > le corps du texte
描述你的问题
iOS 夜间模式 实现原理
贴上相关代码
-(BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
self.window = [[UIWindow alloc]initWithFrame:[UIScreen mainScreen].bounds];
self.window.backgroundColor = [UIColor whiteColor];
[self.window makeKeyAndVisible];
ViewController *rootVC = [[ViewController alloc]init];
UINavigationController *nav = [[UINavigationController alloc]initWithRootViewController:rootVC];
UIView *view = [[UIView alloc]init];
view.backgroundColor = [UIColor grayColor];
view.alpha = 0.4;
view.userInteractionEnabled = NO;
[nav.view addSubview:view];
[view mas_makeConstraints:^(MASConstraintMaker *make) {
make.edges.mas_equalTo(nav.view);
}];
self.window.rootViewController = nav;
return YES;
}
贴上报错信息
以上方法为什么实现不了。。。求真相。。
贴上相关截图
已经尝试过哪些方法仍然没解决(附上相关链接)
高洛峰2017-04-28 09:08:27
Activer et désactiver le mode nuit via le mode singleton, référez-vous au principe de cet article http://www.jianshu.com/p/a38850421c56