Common bugs in iOS7 and their fix

As we are aware of IOS7 and it release every app which has developed earlier with OS version less than IOS7 must upgrade to support IOS7 and its compatibility. Some of the issue we have seen while upgrading the app to support IOS7 compatible are as follows:

1. Status bar merging with navigation bar

2. Space on Top and Bottom (iPhone 5)

3. UITableView Cell Background with Default white color.

4. UITabBar Background as iOS7 default white color.

 

Status bar merging with navigation bar

In IOS7, the status bar is transparent, the view behind it shows through. The style of the status bar refers to the appearance of its content, which includes items such as time, battery charge, and Wi-Fi signal.

 

Issue : UIViewController/UITableViewController with status bar and Navigation bar merge

iOS Simulator Screen shot 21-Nov-2013 6.44.35 PM

Fix: Using the following piece of code in viewWillAppear will fix this issue

if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 7.0) {

CGRect screen = [[UIScreen mainScreen] bounds];

if (self.navigationController)

{

CGRect frame = self.navigationController.view.frame;

frame.origin.y = 20;

frame.size.height = screen.size.height – 20;

self.navigationController.view.frame = frame;

}

else {

if ([self respondsToSelector: @selector(containerView)]) {

UIView *containerView = (UIView *)[self performSelector: @selector(containerView)];

CGRect frame = containerView.frame;

frame.origin.y = 20;

frame.size.height = screen.size.height – 20;

containerView.frame = frame;

}

else {

CGRect frame = self.view.frame; frame.origin.y = 20;

frame.size.height = screen.size.height – 20;

self.view.frame = frame;

}

}

}

Result:

iOS Simulator Screen shot 21-Nov-2013 6.44.50 PM

 

 

Space on Top and Bottom (iPhone 5)

When you run iPhone 4 app on iPhone 5 device it use to show spacing at top and bottom, since the size of iPhone 4 is 320×480 when run on iPhone 5(320×568) it use to align the app at center of the screen by leaving space at top and bottom which will look like

iOS Simulator Screen shot 21-Nov-2013 5.09.01 PM

Fix: Please follow the step given here

 

UITableView Cell Background with Default white color

As IOS7 default UITableViewCell will be of white color, it will work fine if we haven’t customise the cell and using the default behaviour in the earlier version. If we have customise the cell in the earlier version then cell will have a background with white color

Issue: UITableViewCell with background white color instead of default color

iOS Simulator Screen shot 21-Nov-2013 5.09.19 PM

Fix: Add this line of code “cell.backgroundColor = [UIColor clearColor];” in  UITableViewDataSource tableView:cellForRowAtIndexPath method

Ex - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{

// Initailization code goes here

UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; cell.backgroundColor = [UIColor clearColor]; 

// remaining code goes here

}

Result:

iOS Simulator Screen shot 21-Nov-2013 5.09.01 PM

 

TabBar Background as iOS7 default white color.

For iOS 6 and earlier UITabBar will be of black color as default, where as for iOS7 it will be white in color, so to match the app similar to iOS 6 we can make the UITabbar with black color by using the following code while creating the UITabBarController

[[UITabBar appearance] setTintColor:[UIColor whiteColor]]; // For TabBar Item TextColor    [[UITabBar appearance] setBarTintColor:[UIColor blackColor]];// TabBar Item Background Color

Issue: IOS7 Tab Bar with default white background color

iOS Simulator Screen shot 21-Nov-2013 6.44.50 PM

Fix: Add following code while creating UITabBarController

[[UITabBar appearance] setTintColor:[UIColor whiteColor]]; // For TabBar Item TextColor [[UITabBar appearance] setBarTintColor:[UIColor blackColor]];// TabBar Item Background Color

Result:

iOS Simulator Screen shot 21-Nov-2013 7.10.55 PM

The following two tabs change content below.

khan

Latest posts by khan (see all)