Search code examples
iphoneiosstatusbarnavigationbar

Status Bar issue


As you can see from my image, the status bar is displaying on top of my table view and i don't understand what i have done wrong for this to happen. i am sure that it will be a simple fix and i'm just missing it.

Any help will be much appreciated, Thanks!

In App View


Solution

  • you can avoid this problem by writing below code in ViewDidLoad method...

      float SystemVersion=[[[UIDevice currentDevice] systemVersion] floatValue];
    
    if(SystemVersion<7.0f)
    {
    //Currently your app is running in IOS6 or older version. So you need not to do anything.  
    }
    else
    {
    // Currently your app is running in IOS7. Do the following.
    
    CGRect TempRect;
    for(UIView *sub in [[self view] subviews])
    {
        TempRect=[sub frame];
        TempRect.origin.y+=20.0f; //Height of status bar
        [sub setFrame:TempRect];
    }
    }
    

    let me know it is working or not my friend!!!

    Happy Coding!!!!