iOS的颜色转变导航栏

问题描述 投票:2回答:3

我的主导航栏的颜色是暗红色的。但是,当我原图查看图片,我想有一个黑色的。但它看起来如下:

Color Transition

任何人都知道为什么过渡不是很顺利?

我设置在viewWillAppear中法全尺寸图像视图控制器的颜色,并将其恢复到红色在viewWillDisappear方法。

希望您能够帮助我。

ios swift colors
3个回答
0
投票

它是跨褪色的导航栏,因为这是导航栏只允许动画。我不认为有任何其他办法让它做一个梯度。


0
投票

请使用此:

override func willMove(toParent parent: UIViewController?) {
    self.navigationController?.navigationBar.barTintColor = .red

}

0
投票

发生这种情况时,你给给导航栏的颜色一样清晰彩色我猜,但你可以通过在AppDelegate的文件中声明,以便它可以在所有ViewControllers像下面应用解决这个问题,

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 }

我希望它可以帮助你out.good运气。

© www.soinside.com 2019 - 2024. All rights reserved.