Create an account

Very important

  • To access the important data of the forums, you must be active in each forum and especially in the leaks and database leaks section, send data and after sending the data and activity, data and important content will be opened and visible for you.
  • You will only see chat messages from people who are at or below your level.
  • More than 500,000 database leaks and millions of account leaks are waiting for you, so access and view with more activity.
  • Many important data are inactive and inaccessible for you, so open them with activity. (This will be done automatically)


Thread Rating:
  • 383 Vote(s) - 3.38 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Change color of Back button in navigation bar

#21
**Swift 3**

The most upvoted answer is not correct for Swift 3.

[![enter image description here][1]][1]

The correct code to change color is:

self.navigationController?.navigationBar.tintColor = UIColor.white

If you want to change color, change UIColor.white above to the desired color
[1]:
Reply

#22
This code changes the arrow color

self.navigationController.navigationBar.tintColor = UIColor.whiteColor();

If this does not work, use the code below:

self.navigationBar.barStyle = UIBarStyle.Black
self.navigationBar.tintColor = UIColor.whiteColor()

**Swift 3 Notes**

`UIColor.whiteColor()` and similar have been simplified to `UIColor.white`

Also, many previously implicit optionals have been changed to explicit, so you might need:

self.navigationController?.navigationBar =
Reply

#23
You should use this:

navigationController?.navigationBar.barTintColor = .purple
navigationController?.navigationBar.tintColor = .white
Reply

#24
Very easy to set up in the storyboard:

[![enter image description here][1]][1]


[![enter image description here][2]][2]


[1]:

[2]:
Reply

#25
You have one choice hide your back button and make it with your self.
Then set its color.

I did that:

self.navigationItem.setHidesBackButton(true, animated: true)
let backbtn = UIBarButtonItem(title: "Back", style:UIBarButtonItemStyle.Plain, target: self, action: "backTapped:")
self.navigationItem.leftBarButtonItem = backbtn
self.navigationItem.leftBarButtonItem?.tintColor = UIColor.grayColor()
Reply

#26
self.navigationController.navigationBar.tintColor = [UIColor whiteColor];

This works for me, iOS 9.0+
Reply

#27
in swift 2.0 use

self.navigationController!.navigationBar.tintColor = UIColor.whiteColor();
Reply

#28
Lets try this code:

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

let navigationBarAppearace = UINavigationBar.appearance()
navigationBarAppearace.tintColor = UIColor.whiteColor() // Back buttons and such
navigationBarAppearace.barTintColor = UIColor.purpleColor() // Bar's background color
navigationBarAppearace.titleTextAttributes = [NSForegroundColorAttributeName:UIColor.whiteColor()] // Title's text color

self.window?.backgroundColor = UIColor.whiteColor()
return true
}
Reply

#29
For Swift 2.0, To change the **Navigation-bar tint color**, **title text** and **back button** tint color changed by using the following in AppDelegate.swift




func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {

// Override point for customization after application launch.


//Navigation bar tint color change

UINavigationBar.appearance().barTintColor = UIColor(red: 42/255.0, green: 140/255.0, blue: 166/255.0, alpha: 0.5)

//Back button tint color change

UINavigationBar.appearance().barStyle = UIBarStyle.Default
UINavigationBar.appearance().tintColor = UIColor(red: 204/255.0, green: 255/255.0, blue: 204/255.0, alpha: 1)

//Navigation Menu font tint color change

UINavigationBar.appearance().titleTextAttributes = [NSForegroundColorAttributeName: UIColor(red: 204/255.0, green: 255/255.0, blue: 204/255.0, alpha: 1), NSFontAttributeName: UIFont(name: "OpenSans-Bold", size: 25)!]//UIColor(red: 42/255.0, green: 140/255.0, blue: 166/255.0, alpha: 1.0)

UIApplication.sharedApplication().statusBarStyle = UIStatusBarStyle.LightContent


return true
}
Reply

#30
You can use like this one. Place it inside `AppDelegate.swift`.

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

UINavigationBar.appearance().translucent = false
UINavigationBar.appearance().barTintColor = UIColor(rgba: "#2c8eb5")
UINavigationBar.appearance().tintColor = UIColor.whiteColor()
UINavigationBar.appearance().titleTextAttributes = [NSForegroundColorAttributeName:UIColor.whiteColor()]

return true
}
Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)

©0Day  2016 - 2023 | All Rights Reserved.  Made with    for the community. Connected through