Click the button to make the button flip animation left and right

Source: Internet
Author: User

1 //uiview.transition2 3 //1. You can set the transition animation from one view to another view4 //uiview.transition (from: < #T # #UIView #>, to: < #T # #UIView #>, Duration: < #T # #TimeInterval #> Options: < #T # #UIViewAnimationOptions #>, completion: < #T # # ((bool)-void)? # # (BOOL)- > void#>)5 6 //2, you can set a view of the animation (such as flipping)7 //uiview.transition (with: < #T # #UIView #>, Duration: < #T # #TimeInterval #>, Options: < #T # # Uiviewanimationoptions#>, animations: < #T # # (() void)? # # (()-void)? # # (), Void#>, completion: < #T # # ((BOOL)-void)? # # ((bool)-void)? # # (BOOL)-void#>)8 9 Import UIKitTen  One classViewcontroller:uiviewcontroller { A      -     Privatevar Iszhengmian:bool =true -      the     Overridefunc viewdidload () { - super.viewdidload () -     } -      + @IBAction Func Btnclick (_ Sender:uibutton) { -Iszhengmian =!Iszhengmian +         ifiszhengmian{//front, with text, flip from left to right AUiview.transition (With:sender, Duration:0.5, Options:UIViewAnimationOptions.transitionFlipFromLeft, animations: { atSender.settitle ("?", for:. Normal) -}, Completion: {(_)inch -                  -             }) -}Else{//reverse, without text, flip right to left -Uiview.transition (With:sender, Duration:0.5, Options:UIViewAnimationOptions.transitionFlipFromRight, animations: { inSender.settitle (Nil, for:. Normal) -}, Completion: {(_)inch to                  +             }) -         } the     } *}

Click the button to make the button flip animation left and right

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.