Customized back button appears on UIImagePickerController

前端 未结 3 1191
再見小時候
再見小時候 2021-01-13 02:50

I use the following code to customize the back button on the navigation bar throughout my application:

UIImage *backButton = [[UIImage imageNamed:@\"backButt         


        
相关标签:
3条回答
  • 2021-01-13 03:16

    1.for swift and ios9(the above answer will be like) --

        UIBarButtonItem.appearanceWhenContainedInInstancesOfClasses([UIImagePickerController.self]).setBackButtonBackgroundImage(UIImage(named: "blank-button"), forState: UIControlState.Normal, barMetrics: UIBarMetrics.Default)
    

    2.if you want to modify backIndicatorImage of UINavigationBar

    UINavigationBar.appearanceWhenContainedInInstancesOfClasses([UIImagePickerController.self]).backIndicatorImage = UIImage(named: "backButton")//or nil
    

    3.if you want to modify backIndicatorTransitionMaskImage

    UINavigationBar.appearanceWhenContainedInInstancesOfClasses([UIImagePickerController.self]).backIndicatorTransitionMaskImage =UIImage(named: "backButton")// nil
    
    0 讨论(0)
  • 2021-01-13 03:17

    Try using this:

        [[UINavigationBar appearanceWhenContainedIn:[YourClassThatsNotAUIImagePicker class], nil] setBackButtonBackgroundImage:someOtherImage forBarMetrics:UIBarMetricsDefault];
    

    That should limit your appearance setting to only the classes you list and therefore leave the UIImagePickerController alone.

    0 讨论(0)
  • 2021-01-13 03:24
     [[UIBarButtonItem appearanceWhenContainedIn:[UIImagePickerController class], nil] setBackButtonBackgroundImage:[UIImage imageNamed:@"blank-button"] forState:UIControlStateNormal barMetrics:UIBarMetricsDefault];
    

    this is the correct way

    0 讨论(0)
提交回复
热议问题