Thursday, December 12, 2013

How to get the current screen status, such as horizontal screen left and right transverse cross?

Will Object-C how to obtain the status of the current screen?
I need to capture the screen in the end is horizontal or vertical screen display, but also points left cross and right cross. . .

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

UIInterfaceOrientationPortrait is an enumeration value, there are four state value! You can go check under
Reply:
Direction by getting the battery of the device to determine the direction of
uidevice currentdevice the orientation direction of the device can be read
You can also calculate the angle
equipmenthttp://blog.csdn.net/ArthurChenJS/archive/2011/04/24/6358511.aspx
Reply:
The reply was deleted at the moderator 2011-05-06 08:42:37

Reply:
Yes, UIApplication and UIDevice can get to
Reply:
The following code can be used to determine the orientation
iPhone screen
@ Interface UIViewController (UIViewControllerRotation)
@ Property (nonatomic, readonly) UIInterfaceOrientation interfaceOrientation;
The current direction of
UIViewController
UIKIT_EXTERN_CLASS @ interface UIDevice: NSObject
@ Property (nonatomic, readonly) UIDeviceOrientation orientation; / / return current device orientation
Device orientation

Reply:
The reply was deleted at the moderator 2012-03-02 09:20:20

No comments:

Post a Comment