如何检测UI方向是否被锁定?如果可以,我该如何做?
仅当UI方向未被锁定时,我想对重力传感器进行操作。
如何检测UI方向是否被锁定?如果可以,我该如何做?
仅当UI方向未被锁定时,我想对重力传感器进行操作。
if([self shouldAutorotateToInterfaceOrientation:UIInterfaceOrientationLandscapeLeft])
NSLog(@"Rotates LandscapeLeft");
if([self shouldAutorotateToInterfaceOrientation:UIInterfaceOrientationLandscapeRight])
NSLog(@"Rotates LandscapeRight");
if([self shouldAutorotateToInterfaceOrientation:UIInterfaceOrientationPortrait])
NSLog(@"Rotates Portrait");
if([self shouldAutorotateToInterfaceOrientation:UIInterfaceOrientationPortraitUpsideDown])
NSLog(@"Rotates PortraitUpsideDown");
希望这能解决你的问题。