问题描述
描述你的问题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;}
贴上报错信息以上方法为什么实现不了。。。求真相。。
贴上相关截图
已经尝试过哪些方法仍然没解决(附上相关链接)
问题解答
回答1:通过单例模式实现夜间模式的开启关闭,参照这个文章原理http://www.jianshu.com/p/a38850421c56