A view controller is in landscape mode, but I'm getting the frame from portrait mode?

后端 未结 3 1118
有刺的猬
有刺的猬 2021-02-10 19:47

I have a settings view controller with a table view. The table view is supposed to set its frame to be the frame of the view controller. My app only supports landscape mode, so

3条回答
  •  难免孤独
    2021-02-10 20:17

    You have to implement this in your settings view controller:-

    -(void)viewWillAppear:(BOOL)animated{
        [super viewWillAppear:animated];
        [[UIDevice currentDevice] setOrientation:UIInterfaceOrientationPortrait];
        }
    

提交回复
热议问题