1

I have added a custom titleView to my UINavigationItem, and that contains a view that is intended to be under the status bar. It looks fine, and when I push another viewcontroller and that transitions away in the standard right-to-left animation it looks fine. However, when I [self.navigationController popViewControllerAnimated:YES] it clips the top of this view until the animation is finished. Please see attached image for a better explanation of the problem.

It's only until after the pop-animation is done that it looks normal again. I have tried everything I can think of. Setting cropsToBounds to NO on all the views the viewController AND navigationBar. I've tried also layer.masksToBounds and just about every property that sounds familiar. I've added a timer that prints the frame rectangle of the navigationBar and the custom titleView and it doesn't appear that they change anything.

Does anybody know what I'm doing wrong?

the problem

Erik Rothoff
  • 4,826
  • 9
  • 41
  • 59

1 Answers1

2

Two ways to do it :

    if ([self respondsToSelector:@selector(setEdgesForExtendedLayout:)]) { // if iOS 7
    self.edgesForExtendedLayout = UIRectEdgeNone; //layout adjustements
}

Or

You need to set Delta of your view controller. Switch Story board to ios6.1 or later from utility area (1st item). Then select view of your Vc and in size inspector menu in utility area there will be delta section below frame. There will be triangle before every delta. Triangle y to 64 (you should be on ios6.1 or later of your storyboard).

If you need help on Deltas visit : Interface Builder: What are the UIView's Layout iOS 6/7 Deltas for?

Community
  • 1
  • 1
Zeeshan
  • 4,194
  • 28
  • 32
  • I have tried setting `edgesForExtendedLayout` to `UIRectEdgeNone` and `UIRectEdgeAll` on all viewControllers I can think of, no difference. The problem is not the typical status bar overlapping because of the iOS6/7 frame changes. It's that the UINavigationBar clips the content while animating. I do not what it to clip or mask the content while animating. – Erik Rothoff Jan 11 '14 at 12:29
  • Try second option as its better. Ever used Deltas ? – Zeeshan Jan 11 '14 at 12:32
  • Deltas are not going to fix this issue as it's not the difference between iOS6 and 7. Like I said, it looks fine when it's not in a transition state. When the pop-animation is complete the clip'ed part of the orange bar appears again. I don't see how deltas will solve this. – Erik Rothoff Jan 11 '14 at 12:37