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

Written by dermdaly on October 9th, 2012

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.

Comment on this post

Let us build your app

We offer native app development for iPhone, iPad, Android and Windows Phone; with full service from idea generation through to getting your app on the App Store. If you’d like to discuss your app development needs, get in touch.

By continuing to use the site, you agree to the use of cookies. more information

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.