Pages

Tuesday, October 8, 2013

Move NavigationController for iOS7

Converting iOS 6 app to iOS 7 there is a problem with top navigation for iOS 7. So i found a solution for this. 

Note: Although there are a lot of solutions for this like delta updating in NIB file. but i found this useful and applied in my current project as well.

It should be added in AppDeletegate Class and in didFinishLaunchingWithOptions function before return YES;

    CGRect aRect = self.navigationController.view.frame;
    if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"7.0")) {
        aRect.origin.y = 20.0f;
        aRect.size.height -= aRect.origin.y;
    }
    else
    {
        aRect.origin.y = 0.0;
    }
    self.navigationController.view.frame = aRect;
    [self.window setBackgroundColor:[UIColor whiteColor]];