Offset on UIWindow addSubview

前端 未结 4 2011
无人及你
无人及你 2020-12-02 06:42

I\'ve got a UITabBar based application that works just fine. Under certain circumstances I am showing a different UIViewController instead though. Now what bugs me is that t

4条回答
  •  独厮守ぢ
    2020-12-02 07:21

    Just to second what was said above: Here's the code I had to use:

    #define MAIN_SCREEN_OFFSET_PIXELS     20
    
    - (void) pushDownViewOnMainScreen {
      CGRect r = [[UIScreen mainScreen] applicationFrame];
      r.origin.y -= MAIN_SCREEN_OFFSET_PIXELS;
    
      self.view.frame = r;
    }
    
    
    - (void) viewDidLoad {
      [self pushDownViewOnMainScreen];
    
      // ...
    }
    

提交回复
热议问题