Left menu overlaps status bar

98 Views Asked by At

Basically, this is what happens when I click on the left menu button.

https://i.stack.imgur.com/g7uq6.png

I want it to appear under the status bar and not to overlap it.

Here's the code:

HomeViewController.m

-(void)menuBarButtonItemClick{

    mJUserAccountMenuViewController = nil;
    mJUserAccountMenuViewController = [[MJUserAccountMenuViewController alloc] initWithNibName:@"MJUserAccountMenuViewController" bundle:nil];
    mJUserAccountMenuViewController.delegate = self;
    [self presentPopupViewController:mJUserAccountMenuViewController animationType:MJPopupViewAnimationSlideLeftRight];
}

mJUSerAccountMenuViewController.m

- (void)viewDidLoad
{
    [super viewDidLoad];

    leftMenuArrayy = [StaticDataCollection getSharedInstance].accountMenuArray;

    backTOHomelabl.font = FONT_APP_DEFAULT_FONT;
    backTOHomelabl.textColor = COLOR_WHITE_COLOR;

    if (IS_IPHONE_5_SCREEN) {
        [self.view setFrame:CGRectMake(0, 0, 250, 568)];
    } else {
        [self.view setFrame:CGRectMake(0, 0, 250, 480)];
    }
}
1

There are 1 best solutions below

1
On

If you are using storyboard and AutoLayout, you can set the top of menu equals top layout guide.

If you're using xib, you can set iOS 6/7 Delta to plus or minus y offset 20(Status bar's height).

If you set layout by code, you have to check the version of iOS. For example:

if([[[UIDevice currentDevice] systemVersion] integerValue] >= 7)
{
    // set the subviews' offset +20px(statusBar's height)
}