开发者

View offset by navigation bar

开发者 https://www.devze.com 2023-04-11 13:23 出处:网络
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 UINavigation

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 th开发者_Python百科ink it may be the navigation bar going over the view however I'm not sure how to correct this.


  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
    }
    
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号