Reputation: 4036
I don't know how to make a navigation controller use the default <
button. The only way I know how to add a back button at all is to add a Bar Button Item
but there I have to provide the image myself. I want to use the default system back symbol, the kind that shows up with show/push segue. Is this possible?
Upvotes: 2
Views: 6880
Reputation: 9226
i guess we can't use < by default. we need to add < image. i think you should create a class Basecontroller and inherit all classes from this. and write this code in that class, so you don't need to add < image to all controller. just set image in only one class.
class BaseController: UIViewControlller {
override func viewDidLoad() {
super.viewDidLoad()
self.navigationController?.navigationBar.backIndicatorImage = UIImage(named: "back_indicator")
self.navigationController?.navigationBar.backIndicatorTransitionMaskImage = UIImage(named: "back_indicator")
self.navigationItem.backBarButtonItem = UIBarButtonItem(title:"", style:.Plain, target:nil, action:nil)
}
}
Upvotes: 2
Reputation: 4271
I'm guessing you're talking about doing this when presenting a view controller modally. You can't add get the < as you would in a push segue because Apple decided to just not build it in (as far as I know). Your best bet is to create a left bar button item with the text "<" or create your own back button and set it to that image to give your app some uniqueness!
Upvotes: 8