appearance
您可以使用代理全局更改条形颜色:
尝试
[[UINavigationBar appearance] setTintColor:[UIColor blueColor]];
[[UIBarButtonItem appearance] setTintColor:[UIColor blueColor]];
否则试试
[self presentViewController:safariVC animated:YES completion:^{
[safariVC.navigationBar setTintColor:[UIColor blueColor]];
}];
否则试试
在 AppDelegate.m 函数中:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
我输入了以下代码:
//SFSafariViewController
[[UINavigationBar appearanceWhenContainedIn:[SFSafariViewController class], nil] setBarTintColor:[UIColor blueColor]];
[[UINavigationBar appearanceWhenContainedIn:[SFSafariViewController class], nil] setTintColor:[UIColor blueColor]];
或添加您的 ViewDidLoad
[self.navigationController.navigationBar setTintColor:[UIColor whiteColor]];
迅速
UINavigationBar.appearance().tintColor = UIColor.blueColor()
UIBarButtonItem.appearance().tintColor = UIColor.blueColor()
否则试试这个
self.presentViewController(safariVC, animated: true, completion: {() -> Void in
safariVC.navigationBar.tintColor = UIColor.blueColor()
})
或者喜欢
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject : AnyObject]?) -> Bool {
UINavigationBar.appearanceWhenContainedIn(SFSafariViewController.self, nil).barTintColor = UIColor.blueColor()
UINavigationBar.appearanceWhenContainedIn(SFSafariViewController.self, nil).tintColor = UIColor.blueColor()
}
或者最后试试这个
self.navigationController.navigationBar.tintColor = UIColor.whiteColor()