Wednesday, 11 December 2013

Issues in iOS 7.0



                  FEW ISSUES WHICH I GOT IN MY APP WHILE UPDATING TO iOS 7.0



1.) To avoid a white line at start of separator in UITableView.

In iOS 7.0 tableView, Separator starts from where the text(Cell title and detail title) starts.
If you want to avoid it and want that your cell separator starts from initial.

Do code :

{
     CGRect separatorFrame;
     separatorFrame = CGRectMake(0, 59, 320, 1);  // set separator frame according to your table cell

     UIImageView *rowSaperatorImageView = [[UIImageView alloc]
                                          initWithFrame:separatorFrame];
     rowSaperatorImageView.image=[UIImage     imageNamed:kCELL_ROW_SEPARATOR_IMAGE_NAME];
   
     [cell.contentView addSubview:rowSaperatorImageView];
}

You need to add your own separator image to cell content view instead of doing this :

      UIColor *color = [UIColor colorWithPatternImage:[UIImage                                                           imageNamed:kCELL_ROW_SEPARATOR_IMAGE_NAME]];
     [tableView setSeparatorColor:color];



2.)Warning :  Implicit conversion from enumeration type 'enum UILineBreakMode' to different enumeration type 'NSLineBreakMode' (aka 'enum NSLineBreakMode')

Constant for setting line break mode got changes from iOS 7.
For this you will get warning.

Do the following code to avoid this warning :

#ifdef __IPHONE_6_0
# define LINE_BREAK_WORD_WRAP NSLineBreakByWordWrapping
#else
# define LINE_BREAK_WORD_WRAP UILineBreakModeWordWrap
#endif
    [[cell textLabel] setLineBreakMode:LINE_BREAK_WORD_WRAP];

Note : If you set it for iOS 6(that is, NSLineBreakByWordWrapping) it wont give any warning but when you run the app you will find that constant won't work for iOS 7.
And,if you set it for iOS 7(that is, NSLineBreakByWordWrap) it will give above warning.


3.) To avoid white background color on TableView Cell.

If you have set any background color for your tableView cell, running your Application on iOS 7 device you will find that your tableView cell's background will not get visible.
To resolve this issue you need to explicitly do clear color for your table View Cells.

Do implement this delegate method :

- (void)tableView:(UITableView *)tableView
  willDisplayCell:(UITableViewCell *)cell
forRowAtIndexPath:(NSIndexPath *)indexPath
{
    [cell setBackgroundColor:[UIColor clearColor]];
}


4.) Entire view moved up after picker is dismissed

One more issue which I got  while running my App is that dismissing picker view from any text editable field will move the whole view up .To resolve this we have coded this on all view controllers that has picker :

 - (void)navigationController:(UINavigationController *)navigationController
      willShowViewController:(UIViewController *)viewController
                    animated:(BOOL)animated
{
    if(kIOS_VERSION >= 7)
    {
        viewController.edgesForExtendedLayout = UIRectEdgeNone;
       
        [[UIApplication sharedApplication]
         setStatusBarStyle:UIStatusBarStyleLightContent];
    }
}

Note : Reason of this issue could be our custom Pickers or can be UINavigationController category.


5.) View Behind Status Bar

Another very common issue, entire view moves up behind status bar that means it will not leave 20px of status bar 


Do Code following on all view controller's viewDidLoad() that have this  issue :

    if (kIOS_VERSION >= 7)
    {
        self.edgesForExtendedLayout = UIRectEdgeNone;
    }


6.) View background not covering entire view

I also found very common issue in my App too. Views have white space at bottom that means the view background that I have set was not covering the whole view from top to bottom.

I did this code in View Controller's viewWillAppear() to resolve it :

    self.viewBackground.frame = self.view.bounds;

If you have set background frame to self.view.frame, change it to self.view.bounds



Please Note : If your App is supporting iOS < 7.0, do write this code specific to iOS 7 in your view controllers. If you do this for iOS it might be possible that your running code on iOS < 7 gets disturbed.


Happy Coding ..!!










No comments:

Post a Comment