Changing NavigationBar Title of UIImagePickerController

前端 未结 3 1073
你的背包
你的背包 2020-12-20 21:38

I want to know how we can change the navigation bar title of UIImagePickerController. I tried several ways but couldn\'t do it.

tried the follwing ways,



        
相关标签:
3条回答
  • 2020-12-20 22:10

    I found the way to do it. When you set your UIImagePickerController delegate to self and implement the following method it worked.

    - (void)navigationController:(UINavigationController *)navigationController willShowViewController:(UIViewController *)viewController animated:(BOOL)animated
    {
        [viewController.navigationItem setTitle:@""];
    }
    

    Found it from this link http://forums.macrumors.com/showthread.php?t=533216

    Thanks...

    0 讨论(0)
  • 2020-12-20 22:10

    Swift

    IOS 8 || 9

    func navigationController(navigationController: UINavigationController, willShowViewController viewController: UIViewController, animated: Bool) 
      {
        viewController.navigationItem.title = "video" // Change title
        imagePicker.navigationBar.tintColor = .whiteColor() //Text Color
        imagePicker.navigationBar.titleTextAttributes = [
            NSForegroundColorAttributeName : UIColor.whiteColor()
        ]
    
      }
    
    0 讨论(0)
  • 2020-12-20 22:16

    This should allow you to set the title (the previous answer had a typo):

    - (void)navigationController:(UINavigationController *)navigationController willShowViewController:(UIViewController *)viewController animated:(BOOL)animated
    {
        [viewController.navigationItem setTitle:@"Choose A Photo"];
    }
    
    0 讨论(0)
提交回复
热议问题