Search code examples
iosios5uinavigationbaruiappearance

Using UIAppearance to move UINavigationBar


I am trying to increase the height of the UINavigationBar via UIAppearance

The height itself does change but part of the bar is obscured by the device status bar. I would like to move the bar down 22 pixels so it is fully visible:

[[UINavigationBar appearance] setFrame:CGRectMake([[UINavigationBar appearance] frame].origin.x, 22, [[UINavigationBar appearance] frame].size.width, 103)];

And I also set the autoresizing mask

[[UINavigationBar appearance] setAutoresizingMask:UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleBottomMargin];

But the bar is not translated. Is there another way or another step here?


Solution

  • You can move down only title by this:

    [[UINavigationBar appearance] setTitleVerticalPositionAdjustment:5 forBarMetrics:UIBarMetricsDefault];