Bradley
Bradley

Reputation: 617

View offset by navigation bar

I have a place profile set up that displays place information in a nib. When I push this view in the standard screen flow it works fine. However when I push this view from another tab the UINavigationBar seems to offset it please see image here - http://imageshack.us/photo/my-images/525/screenshot20111006at225.png/ I think it may be the navigation bar going over the view however I'm not sure how to correct this.

Upvotes: 1

Views: 2105

Answers (1)

user244343
user244343

Reputation:

  1. In Interface Builder, make sure the view is autosizing and you've turned on the Navigation Bar in "Simulated Metrics", so that the top Y coordinate is 44 as opposed to zero. Oh, and make sure your navigation bar isn't set to Black Translucent, but Black Opaque.
  2. To manually correct, set self.view.bounds to the right co-ordinates in your featured view's viewWillAppear or viewDidLoad (if you use manual coordinates, viewDidLoad is fine, but I think you need viewWillAppear if you're using parts of self.navigationController like the position of navigationBar). For example:

    - (void) viewDidLoad
    {
        [super viewDidLoad];
        self.view.bounds = CGRectMake(0, 44, 320, 367); // assuming tabbar+navbar
    }
    

Upvotes: 1

Related Questions