PassionateDeveloper
PassionateDeveloper

Reputation: 15138

How to have a "Back button style" in the UINavigatorBar / Button

I have a UINavigatorBar and dropped a button to the left top corner in the Interface Builder.

Simple question: The Button is round, how I can set the button to a "back-style" button? (I mean, that the left side of the button is not round, it should be a arrow).

Upvotes: 2

Views: 1542

Answers (3)

typeoneerror
typeoneerror

Reputation: 56948

I just put together a simple UIViewController subclass that adds a customizable back button that allows you to change text colors. It basically adds some willAppear/willDisappear logic to animate the back button the way the UINavigationController does while using the leftBarButtonItem property. You'd just have to swap out the back-button PNG and change your colors in a subclass.

https://github.com/typeoneerror/BBCustomBackButtonViewController

Upvotes: 3

aopsfan
aopsfan

Reputation: 2441

If you want the back button to go back to the last view in the hierarchy, just leave the button off of the top left corner, and it should show up automatically.

Otherwise, you may need to subclass UIBarButtonItem.

Upvotes: 1

Abizern
Abizern

Reputation: 150605

I think if you want to do this with a UINavigationBar that does not work in conjunction with a UINavigationController you need to create a custom view for the button that is shaped like the back button.

Upvotes: 1

Related Questions