Zhen
Zhen

Reputation: 12431

How to shift navigation bar position on the screen

I have added the following code in my app delegate to create a section below the status bar (as seen in the screenshot after the code)

UIWindow *statusWindow = [[UIWindow alloc] initWithFrame:CGRectMake(0, 20, 320, 20)];
statusWindow.windowLevel = UIWindowLevelStatusBar;
statusWindow.hidden = NO;
statusWindow.backgroundColor = [UIColor colorWithWhite:0.0 alpha:0.7];
[statusWindow makeKeyAndVisible];

enter image description here

How can I shift the navigation bar downwards so that the black overlay does not overlap with the navigation bar? Essentially, I would like to achieve an effect like that in the screenshot below:

enter image description here

Any advise or resources on this will be greatly appreciated.

Upvotes: 4

Views: 4224

Answers (2)

user481081
user481081

Reputation:

Change the NavigationController's frame property. Though you should listen to Xav, he speaks the truth. Apple will likely give you the stink eye and put your app in the slow lane of infinite rejection.

Upvotes: 3

Xav
Xav

Reputation: 348

There's some advice on this topic here, but one of the comments does point out that you shouldn't really mess with the Navigation Bar directly - worth checking the Apple guidelines to make sure your app isn't going to be rejected out of hand.

Upvotes: 4

Related Questions