IPad iOS development basics-iPad device Direction recognition

Source: Internet
Author: User


 

 

because Apple requires iPad applications to provide at least portrait and landscape support, therefore, in the Program , it is essential to detect the current direction of the device. Generally, it can be used in the program running:
1 [[uidevice currentdevice] orientation];
To obtain the current device direction, but if the program starts, the result is:
1 uideviceorientationunknown
In fact, you can obtain the direction of the Controller to which the control belongs, so that the direction of the control is consistent with that of the controller, you do not need to care about the current device direction.
example:
1 If (self. interfaceorientation = uideviceorientationportrait)
you can determine whether the program is in the protrait direction at startup.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.