UITabBar Not Seeing Touch Events when you build for iPhone 5? – Try This

by: dermdaly

I’ve just spent an hour or so chasing a bug which had my head scratching. Hope this helps anyone else who encounters this.

The symptoms were as follows:

  1. I had a straightforward UITabBar based app
  2. When testing on 3.5″ screen, it worked fine
  3. When testing on 4″ screen, the tab bar would not respond at all

I tried looking at the view hierarchy, and there was no case of a view overlapping; user interaction was enabled in all the wrong place.
Eventually, I tracked it down to the main window; When I switched on “clip subviews” for this window, I realised that the tab bar wasn’t even drawn. This was the clue.

What was wrong?

Simply put, the project was originally created with a version of XCode 2 years ago. The main window was created in MainWindow.xib, and this had a fixed size (which, for some reason XCode wouldn’t allow me alter), and the autoresize mask couldn’t be altered either.

There was no creation of the window in the App delegate (this all occurred prior when MainWindow.xib was loaded, prior to the app delegate being called).

The fix was simple enough. In the first line of the delegate’s didFinishLaunchingWithOptions I added the following

window.frame = [UIScreen mainScreen].bounds;

Hope this helps someone.

Nevan King was in touch to highlight a more elegant solution. Anthony Prato’s post, is better again.

That’ll teach me to use google before I waste an hour.

You May Also Like

What you can expect from the release of iOS 14

What you can expect from the release of iOS 14

Apple just had their WWDC conference, which was streamed completely online. This is the first time since WWDC began in 2005 that it has been streamlined exclusively online with no in-person event. The video below from The Verge pulls together the Keynote speech in 18...

read more
7 Reasons to outsource mobile app development in 2020

7 Reasons to outsource mobile app development in 2020

Mobile apps make your business more efficient and give you a competitive edge. However, trying to develop an app in-house may cause significant problems. If you don’t have experienced mobile app developers on your team, then hire a professional app development company...

read more


Submit a Comment

Your email address will not be published. Required fields are marked *