Jay Choo
Jay Choo

Reputation: 173

How to change navigation bar title in UIImagePicker?

I'm writing in Swift, so there isn't enough info that I can find to address this.

Anyway, I have everything working fine, i.e.: photo library selection view presented, editing works fine and cropped image gets exported to an image view.

My problem is really when the view is presented modally, the title says "Photos". How do I change this to something else?

var imagePicker = UIImagePickerController()
imagePicker.navigationItem.title = "MY TITLE"

Changing the title text attributes work, but not changing the title itself.

Upvotes: 1

Views: 1451

Answers (2)

Yaroslav Dukal
Yaroslav Dukal

Reputation: 3932

Swift 4

func navigationController(_ navigationController: UINavigationController, willShow viewController: UIViewController, animated: Bool) {
                viewController.navigationItem.title = "asdf"
      }

Upvotes: 0

Casey
Casey

Reputation: 6701

make yourself the delegate of imagePicker and implement:

func navigationController(navigationController: UINavigationController, willShowViewController viewController: UIViewController, animated: Bool) {
    viewController.navigationItem.title = "asdf"
}

found here: Changing NavigationBar Title of UIImagePickerController

Upvotes: 3

Related Questions