Only having one view autorotate in xcode?

前端 未结 2 686
春和景丽
春和景丽 2021-01-06 08:34

Ok so I currently have 3 views and I need only one of them to autorotate to any orientation while the rest stay in portrait. Right now my set up is a splashviewcontroller f

2条回答
  •  感动是毒
    2021-01-06 09:06

    Inside targets summary section, Supported Interface Orientation all items are selected except for Upside Down, so all you need to do is go to your .m file that handles the view and use this piece of code.

    - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
    {
        // Return YES for supported orientations
        return (interfaceOrientation == UIInterfaceOrientationPortrait);
    }
    

    This did the trick for me.

提交回复
热议问题