Setting a Custom Image for a Back Button on UINavigationBar

前端 未结 8 2188
伪装坚强ぢ
伪装坚强ぢ 2020-12-14 10:55

I am trying to set a custom image for the back button that automatically gets place onto a navigation bar when a new view is pushed onto the stack.

I have tried add

8条回答
  •  清歌不尽
    2020-12-14 11:14

    Try the code below, it works for me:

    [[UINavigationBar appearance] setBackIndicatorImage:[UIImage imageNamed:@"back-button-image"]];
    [[UINavigationBar appearance] setBackIndicatorTransitionMaskImage:[UIImage imageNamed:@"back-button-image"]];
    

提交回复
热议问题