Screen rotation animation and API events iPhone

Source: Internet
Author: User

Form: http://wenxin2009.iteye.com/blog/1681584

Ios5 rotating screen: (The following is the Health Check Code, and there are instances in the attachment)

The portrait and landscape screens are two different viewcontrollers. Two viewcontrollers must be created during implementation.

 

// Screen Rotation
-(Bool) shouldautorotatetointerfaceorientation :( uiinterfaceorientation) tointerfaceorientation {

If (tointerfaceorientation = uiinterfaceorientationlandscapeleft | tointerfaceorientation = uiinterfaceorientationlandscaperight ){
// Scenario jump Method 1
[Self authentication mseguewithidentifier: @ "landscapeid" Sender: Self];
// Scenario jump Method 2 (programming)
// Uistoryboard * mainstoryboard = [uistoryboard storyboardwithname: @ "mainstoryboard" Bundle: Nil];
// Landscapeviewcontroller * Land = [mainstoryboard instantiateviewcontrollerwithidentifier: @ "mylandscape"];
// Land. modaltransitionstyle = uimodaltransitionstylecoververtical;
// [Self presentviewcontroller: Land animated: Yes completion: Nil];
Return yes;
} Else if (tointerfaceorientation = uiinterfaceorientationportrait ){

Return yes;
} Else {
Return no;
}
}

 

// Test the rotation method.

  1. // When the rotation direction changes
  2. -(Void) willanimaterotationtointerfaceorientation :( uiinterfaceorientation) tointerfaceorientation duration :( nstimeinterval) Duration {
  3. }
  4. // Automatically called before the first half of the view rotation animation occurs
  5. -(Void) willanimatefirsthalfofrotationtointerfaceorientation :( uiinterfaceorientation) tointerfaceorientation duration :( nstimeinterval) Duration {
  6. }
  7. // Automatically called before the last half of the view rotation animation occurs
  8. -(Void) willanimatesecondhalfofrotationfrominterfaceorientation :( uiinterfaceorientation) frominterfaceorientation duration :( nstimeinterval) Duration {
  9. }
  10. // Automatically called before view Rotation
  11. -(Void) willrotatetointerfaceorientation :( uiinterfaceorientation) tointerfaceorientation duration :( nstimeinterval) Duration {
  12. }
  13. // Automatically called after view Rotation
  14. -(Void) didrotatefrominterfaceorientation :( uiinterfaceorientation) frominterfaceorientation {
  15. }
  16. // Automatically calls the first half of a view rotation animation after it occurs.
  17. -(Void) didanimatefirsthalfofrotationtointerfaceorientation :( uiinterfaceorientation) tointerfaceorientation {
  18. }

Ios6 is so neat:

# Ifdef _ iphone_6_0

-(Bool) shouldautorotate {

Return no;

}

-(Nsuinteger) supportedinterfaceorientations {

Return
Uiinterfaceorientationmaskportrait;

}

# Endif


The following plist settings support orientation rotation:

    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.