How do i remove text from back button on navbar within Xcode?

后端 未结 8 1783
醉酒成梦
醉酒成梦 2021-02-09 05:49

I set an arrow custom image to navigation bar by adding the following code in app delegate, it works but now im looking to remove the text completely for back button.

         


        
8条回答
  •  滥情空心
    2021-02-09 06:15

    Simply move the text vertically so far that it no longer appears. This can be done at app launch in your app delegate.

    [[UIBarButtonItem appearance] setBackButtonTitlePositionAdjustment:UIOffsetMake(0, 20.f) forBarMetrics:UIBarMetricsDefault];
    

    Normally this call is for tweaking the vertical text position which can vary depending on the font used. Here the text is moved far enough that it's no longer inside the Back button view, and so is clipped into non-existence.

提交回复
热议问题