I am making an app where I change the buttons layout depending upon if the user moved his iphone in portrait vs landscape mode. I thought the best place to put my code will be in
-(BOOL) shouldautorotatetointerfaceorientation
But there are two major problems with that
When the page is loaded shouldautorotatetointerfaceorientation is called at least 3 times. I want to execute my code only once.
Even when I move from viewController1 (page1) to viewController2 (page2) with Modal segue and I rotate my iphone on page2 it still calls the autorate code which is in my viewcontroller1. That is very strange.
Anyways, what is the best place to put my orientation based icons in?
The sole purpose of the method
-(BOOL) shouldautorotatetointerfaceorientation
is to determine which orientations are supported.
If you wish to do custom actions on rotation, then you want to implement one or both of the method
-(void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
-(void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)orientation duration:(NSTimeInterval)duration