iPhone: How to set UIViewController frame?

前端 未结 3 2064
长发绾君心
长发绾君心 2020-12-31 02:09

I have a root UIViewController that I am adding other UIViewController\'s as subviews. Currently each of the subviews are too low down (covering up my custom build tabbar).

3条回答
  •  情书的邮戳
    2020-12-31 02:25

    First, ensure that your frame is actually not changing size. Likely it /is/ changing size, but you are expecting it to clip its contents; this behavior is not enabled by default on a UIView, and would need to be set via:

      [[self view] setClipsToBounds:YES];
    

    To double check and ensure that your frame is / is not changing size after setting the new frame, try logging this:

      NSLog(@"New frame is: %@", NSStringFromCGRect([[self view] frame]));
    

    or simply setting a breakpoint after the change and inspecting the value in your debugger.

提交回复
热议问题