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

后端 未结 15 1562
情歌与酒
情歌与酒 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 had this exact problem where I was animating the tab bar and navigation bar off the bottom and top of the screen respectively, leaving a 49px high white space where the tab bar was.

    It turns out that the reason my new "fullscreen" view wasn't actually filling the space was because I was adding the fullscreen view as a subview of the navigation controller's view, which itself was a child of the tab bar controller.

    To fix it, I simply added the new fullscreen view (in your case the view with all the text) as a subview of the UITabBarController's view.

    [[[self tabBarController] view] addSubview:yourTextView];
    

    Then all you need to do is make sure that your subview's frame is 480 x 320px and it should fill the screen (including the area that was previously the mysterious white space)

提交回复
热议问题