Navigation Controller Back Button not working correctly when tapped

Hi

I am having an issue with the Back Button on my Navigation Controller. It looks as though the hitbox of button is misaligned, as although you can tap the button, it doesn't take you back a page like the back button should do. Below is an image showing the hittable areas. The green outlined areas work correctly, the red outlined area does not.

Here is a video with the issue as well. The video shows me tapping on the back button a bunch of times without the button actually working. The final time I press the button I press it at the far right green area shown in the photo.

https://youtu.be/LuWdYbl0BwM

This is the default back button that comes with the Navigation Controller. I tried with a new UiBarButton that I added but I get the same issue.

Has anyone had an issue like this before?

Thanks!

  • The issue was a "hitbox" checker UIButton extension I had implemented a week ago. It was no longer needed so deleting it fixed the issue. Thanks to Claude for helping me realise.

Add a Comment

Replies

No, never met this problem.

Could you tell:

  • Which version of Xcode ?
  • On simulator or device ?
  • Which OS version in anycase.
  • Have you changed the button programmatically, in anyway ?

Are you sure you have nothing overplayed over "Back" ?

Could debug view hierarchy when running to check for this ?

Eventually, create the smallest possible project to reproduce and attach the full project folder here.

  • Hi Claude,

    Thanks for the response.

    Here is the info you requested:

    Xcode version: 12.5.1 Sim or Device: The issue occurs on both iOS: 14.5 Changed the button programmatically: No I havent touched the navigation bar in some time. It's weird as the back button was working fine up until last week and I have been working on this app for well over 4 years.

    I checked the debug view hierarchy and couldn't see the back button being blocked by any element. It's strange as the issue seems to be occurring on all back buttons in my app, not just this one specifically.

    I actually noticed that the issue is currently in the live version of my app on the app store. So you can see it for yourself if you download it. https://apps.apple.com/gb/app/rpg-sounds-fantasy/id1205984620 It will occur on any of the back buttons in the navigation bars.

    I just tried a navigation controller in a brand new project and it worked fine.

    Thanks again!

    And sorry I accidentally selected your answer and the correct answer!

  • So you can see it for yourself if you download it.: I trust what you said. But it is no help, only some source code would allow to understand, as it is something in the project (I just tried a navigation controller in a brand new project and it worked fine.). Did you build some extensions for buttons ?

  • Claude, you're a genius. I completely forgot that a week ago I made a UIButton extension. After commenting the extension out the back button works as normal. Thank you so much for your help!

Please file a bug/feedback with a project that demonstrates the issue.

  • Hi Rincewind,

    I can do that, but my project is fairly large. Will I be able to submit?

    Also, is there anyway to un-accept an answer in a thread? I accidentally accepted Claude's response as an answer.

Add a Comment