iOS7 Navigation bar common issues and their fixes

Apple has released the latest XCode version5, some iOS apps which runs well in the earlier versions of the XCode,but shows some problems when runs under XCode5, Navigation bar issue is one of the most common issues when the app runs with XCode5 and iOS7 environment. Some of the the common navigation bar issues are listed below.

Prevent navigation bar from hiding content

In some apps, navigation bar hides the top view of the content when they run in XCode5, the top view covers some of the content, here are solution on how to prevent the navigation bar hiding the top view of the content.

To hide navigation bar:

(void)viewWillAppear:(BOOL)animated

{

// Hide the top navigation bar.

[self.navigationController.navigationBar setBackgroundImage:[UIImage new] forBarMetrics:UIBarMetricsDefault];

self.navigationController.navigationBar.shadowImage = [UIImage new];

self.navigationController.navigationBar.translucent = YES;

}

//To show navigation bar

(void)viewWillAppear:(BOOL)animated

{

self.navigationController.navigationBar.translucent = NO;

}

 

Prevent navigation bar from shifting down

In some apps navigation bar automatically shift down when they run under XCode5. The below code can can prevent the navigation bar from automatically shifting down.

Apple iOS7 has the default Controller translucent property value is YES, setting up the translucent property value to NO, can prevent this problem.

self.navController.navigationBar.translucent = NO;

This above code line fix the view below the navigation bar.

 

Prevent the app view to overlap with the navigation bar and status bar

Some of the apps shows problems with overlapping app view with the status bar and the navigation bar in the iOS7 devices. It requires to reposition the windows frame and the default translucent property should be set to No, the below code can resolve the problem.

[application setStatusBarStyle:UIStatusBarStyleLightContent];

self.window.clipsToBounds =YES;

self.window.frame = CGRectMake(0, 20, self.window.frame.size.width, self.window.frame.size.height – 20);

 

 

The following two tabs change content below.