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.

Update
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

Top Tips for Gathering In-App Feedback

Top Tips for Gathering In-App Feedback

Developing an app is never a finished product. There are always tweaks that can be made to improve the user experience and make it a better and more desirable product. But whatever changes you make to your app you want to make sure that they are in line with what...

read more
6 Ways to Improve your Apps User Experience

6 Ways to Improve your Apps User Experience

Is your mobile app suffering from "everything but the kitchen sink" syndrome? We often find when working with new clients on their user experience design strategy that they start with an ambitious goal for their app. They want 'everything but the kitchen sink'! While...

read more
3 Best Mobile App A/B Testing Tools

3 Best Mobile App A/B Testing Tools

We spoke about the best practices in mobile app A/B testing in our last post. Here we cover three of the best mobile app A/B testing tools. These tools allow you to run experiments that improve the design of your app while increasing conversion rates. By running these...

read more

0 Comments

Submit a Comment

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