Tree Menu arrow Animation

Source: Internet
Author: User

In TableView's multi-level tree menu implementation, the reality of multi-level Menu is realized. Many times, in order to make the parent menu more indicative, a downward arrow is added to the Menu, to indicate whether the menu is opened. The following animation effects are usually added. [Cpp] [UIView animateWithDuration: 0.25 animations: ^ (void) {imageView. transform = CGAffineTransformRotate (imageView. transform, 3.1415926);} completion: ^ (BOOL finished) {// set default transform imageView. transform = CGAffineTransformMakeRotation (0); imageView. image = [UIImage imageNamed: @ "new_chevron.png"] ;}]; this imageView is required. transform = CGAffineTransformMakeRotation (0); because the conversion is saved when transform is used for animation, That is, use this imageView to re-open the image next time, and the image will be upside down (because we have rotated it to a π angle (180), so we need to first talk about its rotation back, load the new image. Second, because cell is reused, you cannot use an image to rotate it back and forth to save the rotation effect in imageView (this method is not recommended ). When using the animation effect, we found a very strange phenomenon: when using the system's π # define M_PI 3.14159265358979323846264338327950288/* pi */, it will appear that setting the plural number will not be able to rotate along the needle, it may be that the number of digits is too long, causing overflow. You can define a π with a shorter number of digits, for example, # define ROTATION_M_PI 3.1415926.

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.