Reflection of iOS animations

Source: Internet
Author: User

1. Results show

2. Realization of Ideas

1. Using a duplicate layer, make a uiimageview display picture, and then copy the Uiimageview.

2. Note: 复制图层只能复制子层,但是UIImageView只有一个主层,并没有子层,因此不能直接复制UIImageView .

3. Correct practice: The Uiimageview should be added to a uiview, and then copy the UIView layer, you can copy the Uiimageview.

Attention:默认A控件是B控件的子控件,那么A控件的层就是B控件的层的子层。

4. But there is a problem, the default UIView layer is not the replication layer, we want to change the UIView layer into a copy layer, rewrite the +layerclass method.

+ (Class)layerClass{    returnclass];}

5. Reflection effect: is to copy the picture rotated 180 degrees, and then pan down, preferably first offset in, in the rotation.

Careplicatorlayer *layer = (Careplicatorlayer *) self. V. Layer;Layer. InstanceCount=2;FirstYAxis offset Catransform3d transform = catransform3dmaketranslation (0, self. V. Bounds. Size. Height,0);In rotation transform = catransform3drotate (transform, M_PI,1,0,0);Set the layer of deformation for the replication layers. Instancetransform= Transform;Sets the color channel offset, equal to a point offset, which is the shadow effect layer. Instanceredoffset= -0.1;Layer. Instancegreenoffset= -0.1;Layer. Instanceblueoffset= -0.1;Layer. Instancealphaoffset= -0.1;

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

Reflection of iOS animations

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.