I have 2 screens: the first screen support all orientations, the 2nd screen just support landscape right orientation.
I want the first screen to save its orientation before pushing to the second screen and return to that orientation when it pops back from the second screen.
my code:
-(void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
[[UIDevice currentDevice] setValue:@(currentOrientaion) forKey:@"orientation"];
[UIViewController attemptRotationToDeviceOrientation];
}
it's work but sometime screen rotates many time to change orientation.
Someone help me: why is that?