John-Lluch / SWRevealViewController

A UIViewController subclass for presenting side view controllers inspired on the FaceBook and Wunderlist apps, done right !
Other
4.52k stars 989 forks source link

Navigation Bar color within SVRevealViewController #769

Open tataelm opened 6 years ago

tataelm commented 6 years ago

Hello,

I am having a customizing issue. Functionally everything is fine. This my storyboard.

scr

On storyboard, I set that custom color everywhere. But when I choose something to my "left slide view [2]", it shows from here standart color (grayish background, blue tint)

I tried change the color programmatically on viewDidLoad within TableViewController [3], but it only changes the color of previous navigation bar[1]. The color I want to change still the same.

This is the code I use in [3]

let navigationBarAppearnce = UINavigationBar.appearance() navigationBarAppearnce.tintColor = UIColor.white navigationBarAppearnce.barTintColor = UIColor(red: 0.121, green: 0.117, blue: 0.178, alpha: 1.00)

How can I change the color of nav var within SVRevealViewController?

tataelm commented 6 years ago

I have found the answer.. In case anyone has this problem;

go to your appdelegate and write the code in didFinishLaunchingWithOptions

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
        // Override point for customization after application launch.

        let navigationBarAppearnce = UINavigationBar.appearance()
        navigationBarAppearnce.tintColor = UIColor.white
        navigationBarAppearnce.barTintColor = UIColor( red: CGFloat(121/255.0), green: CGFloat(117/255.0), blue: CGFloat(178/255.0), alpha: CGFloat(1.0) )

        return true
    }

this will affect whole navigation bar setting including Navbars within SVRevealViewController