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.)

Bookmark the permalink.

Leave a Reply

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