I want to change the color of back button of a navigation bar to make it look like this
相关问题
- Core Data lightweight migration crashes after App
- How can I implement password recovery in an iPhone
- State preservation and restoration strategies with
- “Zero out” sensitive String data in Swift
- Get the NSRange for the visible text after scroll
相关文章
- 现在使用swift开发ios应用好还是swift?
- UITableView dragging distance with UIRefreshContro
- TCC __TCCAccessRequest_block_invoke
- Where does a host app handle NSExtensionContext#co
- Xcode: Is there a way to change line spacing (UI L
- Swift - hide pickerView after value selected
- How do you detect key up / key down events from a
- didBeginContact:(SKPhysicsContact *)contact not in
try this It is working for me...
The first line of jacob's answer didn't work for me because the backBarButtonItem was NULL. It is NULL because it's been created later automatically when switching to an other ViewController. At that time you can set the title of the button with
but you can't set the tintColor.
What worked for me, was to create a new UIBarButtonItem without any style. Then set the title and color propertys and set it as backBarButtonItem.
Best way I found to set it globally or locally is
If you want to make the button look exactly like in your picture, you may use an image, too:
The background image must be a resizable image for good results.
Set the
backBarButtonItem
'stintColor
:TIP: If you want this to be applied to all
UIBarButtonItem
instances in your application by default, then you can use the newUIAppearance
API to do just that: