Convert view from landscape to portrait?

I have already developed an application for landscape mode, now the client asks to build in both landscape and portrait modes.

How can I convert a landscape to a portrait view?

Now I use this code for Landscape View:

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { return (interfaceOrientation == UIInterfaceOrientationLandscapeLeft) || (interfaceOrientation == UIInterfaceOrientationLandscapeRight); } 

Please help me....

Advance Thanks :)

+6
source share
3 answers

Just to support all orientations, return YES to shouldAutorotateToInterfaceOrientation .

 - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { return YES; //Or to support all but portrait upside down return interfaceOrientation != UIInterfaceOrientationPortraitUpsideDown; } 
+1
source

Learn how to use autoresist masks. In most cases, they are simple, but quite powerful.

0
source

NSPostWhenIdle is right. You just need to return yes shouldAutorotateToInterfaceOrientation. This way you can support all orientations. Look at resizing properties through XIB. which will also facilitate your work.

0
source

Source: https://habr.com/ru/post/924631/


All Articles