Debugging no-touch zones

When converting some iOS apps from iOS6 to iOS7, I came across a very strange bug. I had an app with tons of views and view controllers, and on the right side of the screen, touches wouldn’t be recognized. (For buttons, gestures, scrolling, etc.) It was quite obvious that one of the views frame’s wasn’t covering that part of the screen. The easy way to figure out which view it is is to add:

    self.view.clipsToBounds=true;

inside each viewDidLoad, verify that the dead zone is no longer visible, and then slowly remove the clipsToBounds calls one at a time until the dead zone is visible again, and you’ve found the offending view! Then take whatever steps you need to adjust that view properly.

In my case, a view had a frame (0,0+768,1024) for a landscape view. Changing this to (0,0+1024,768) resolved the issue. Oddly enough, either sized frame didn’t cause iOS6 to have issues, just iOS7.

Hiding the navigation bar shadows in iOS7

I had a doozy of a time trying to hide the tiny little one pixel high grey shadows in the navigation and tab bars. Google had a lot of suggestions, but none of them worked until I came up with a combination of a few that did the trick. In your application:didFinishLaunchingWithOptions: functions, add the following:

   [[UINavigationBar appearance] setShadowImage:[[UIImage alloc] init]];
   [[UINavigationBar appearance] setBackgroundImage:[[UIImage alloc] init] forBarMetrics:UIBarMetricsDefault];

This removes the shadow for all navigation bars and tab bars, so if you want a different behavior this probably won’t work.

Also make sure your navigation bar and tab bar don’t have translucency set. (There’s a checkbox in Interface Builder.)