My main Navigation Bar Color is a dark red. But when I fullsize view a picture, I want to have a black one. But it looks as the following:
Anybody knows why the transition isn't very smooth?
I set the color in the fullsize-image view controller in the viewWillAppear Method, and revert it to the red color in the viewWillDisappear Method.
Hope you can help me.
It is cross-fading your navigation bar because this is the only allowed animation for navigation bars. I don't think there's any other way to make it do a gradient.
Please, use this:
override func willMove(toParent parent: UIViewController?) {
self.navigationController?.navigationBar.barTintColor = .red
}
This happens when you give give navigation bar color as clear color i guess but you can overcome this by declaring it in Appdelegate file so that it can be applied in all ViewControllers like below,
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool
{
// Override point for customization after application launch.
UINavigationBar.appearance.barTintColor = UIColor.red
UINavigationBar.appearance.tintColor = UIColor.white
UINavigationBar.appearance.titleTextAttributes = [NSForegroundColorAttributeName:UIColor.white]
return true
}
i hope it helps you out.good luck.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.