UIView doesn't resize to full screen when hiding the nav bar & tab bar

后端 未结 15 1566
情歌与酒
情歌与酒 2020-12-02 07:28

I have an app that has a tab bar & nav bar for normal interaction. One of my screens is a large portion of text, so I allow the user to tap to go full screen (sort of l

15条回答
  •  伪装坚强ぢ
    2020-12-02 08:11

    I would move the view to the window when you choose to go fullscreen. e.g.

    myView = [self.view retain];
    self.view = nil;
    [window addSubview:myView];
    

    and to go back:

    [myView removeFromSuperView];
    self.view = myView;
    [myView release];
    myView = nil;
    

    By adding the view as a child of the window, it can be totally fullscreen and will be on top of the tab bar.

    You can then combine this with

    [[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications];
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(didRotate:) name:@"UIDeviceOrientationDidChangeNotification" object:nil];
    

    to detect rotation. (I think that you combine this with view.transform = CGAffineTransformMakeRotation to make it rotate...?)

提交回复
热议问题