Mani murugan
Mani murugan

Reputation: 1802

Navigationbar Transparency issue

Initially I developed the xcode project from IOS6..now I need to make it compatible for IOS7..when I do this I got some problem with navigation bar..when I run on IOS 7 current view is overlay on navigation bar that you can see in first image.

enter image description here

to solve this I have added the following code

self.edgesForExtendedLayout=UIRectEdgeNone

it solves my issue..but when I do this I got new issue..I lost the transparency of the navigation bar..that you can see in next image.

enter image description here

Upvotes: 1

Views: 108

Answers (1)

Miraslau
Miraslau

Reputation: 548

if your viewController has xib-file just go to the Size inspector and set in the section "iOS 6/7 Deltas" delta-y = 44 (the height of the navigation bar) for this view. And be sure than in the File inspector in the field "View as:" iOS 7.0 and later option is selected (the default option if you use XCode 5).

UPD: There are also exists another way to reach success, but this is too tricky and I think the first one is better. You can add this code:

if ([[[UIDevice currentDevice] systemVersion] floatValue] < 7.0) {
    CGRect rect = aView.frame;
    rect.origin.y += 44;
    aView.frame = rect;
}

Upvotes: 3

Related Questions