UI外观setTintColor停止工作



AppDelegate::didFinishLaunchingWithOptions的末尾调用下面的方法,并且一切都被染成绿色,正如人们所期望的那样。但偶尔(比如三次),所有控件都变灰了,应用必须重新启动才能恢复绿色?

我应该更频繁地调用这个比在应用程序启动?

- (void)uiAppearance{
    // Light Green
    UIColor *tintColor = [UIColor colorWithRed:82/255.0f green:214/255.0f blue:105/255.0f alpha:1.0f];
    [[UIButton appearance] setTintColor:tintColor];
    [[UINavigationBar appearance] setTintColor:tintColor];
    [[UIImageView appearance] setTintColor:tintColor];
    [[UIActionSheet appearance] setTintColor:tintColor];
    [[UIActionSheet appearance] setTintColor:tintColor];
    [[UIWindow appearance] setTintColor:tintColor];
}

App did finish launching将仅在首次安装应用程序时启动。不需要重复调用该方法,而不是在完成启动后调用它,从应用程序中调用它变为活动状态。此方法将在每次打开应用程序时触发。

最新更新