Basic use of Calayer

Source: Internet
Author: User
Tags border color

Calayer need to import this framework: #import <QuartzCore/QuartzCore.h>first, Calayer Common Properties
Properties Description whether implicit animations are supported
Anchorpoint A point position coincident with the center point, called an "anchor point," where the anchor is described by default at the center point of the image (0.5,0.5) relative to the X, Y position ratio Is
BackgroundColor Layer background color Is
BorderColor Border color Is
BorderWidth Border width Is
Bounds Layer Size Is
Contents Layers display content, such as the ability to display a picture as a layer content Is
Contentsrect The size and position of the layer display content Is
Cornerradius Fillet radius Is
doublesided If the back of the layer is displayed, the default is Yes Whether
Frame The layer size and position does not support implicit animation, so frame is rarely used in calayer, usually using bounds and position instead Whether
Hidden Whether to hide Is
Mask Layer Masks Is
Masktobounds Whether sublayers cut layer boundaries, default to No Is
Opacity Transparency, similar to the alpha of UIView Is
Position The location of the center point of the layer, similar to the UIView Is
Shadowcolor Shadow color Is
Shadowoffset Shadow Offset Is
Shadowopacity Shadow transparency, note the default is 0, this property must be set if the shadow is set Is
Shadowpath Shape of the Shadow Is
Shadowradius Shadow Blur Radius Is
Sublayers Sub-layer Is
Sublayertransform Child layer Deformation Is
Transform Layer deformation Is

Calayer, watch out.

    • The nature of implicit property animation is that these properties are changed by default, cabasicanimation animation implementation is implied, so it appears to be animated, default 0.25 seconds
    • The frame property is rarely used in Calayer because the frame itself does not support animation effects, usually using bounds and position instead.
    • Transparency in Calayer uses opacity instead of alpha, and the center point uses a position representation instead of center.
    • The Anchorpoint property is the anchor point of the layer, and the range in (0~1,0~1) represents the scale of the x and Y axes, which can always coincide with the position (center point), and when the center point of the layer is fixed, Adjust the anchorpoint to achieve the adjustment layer display position (because it is always coincident with position)

Second, the basic use of Calayer

2.1, the way of assigning valueSelf.iconView.layer.transform = Catransform3dmakescale (1.5, 0.5, 0) Self.iconView.layer.transform = Catransform3dmake           Rotation (m_pi_4, 0, 0, 1)//3d rotation self.iconView.layer.shadowOpacity = 0.5; Set Shadow Transparency Self.iconView.layer.shadowColor = [Uicolor Bluecolor].    Cgcolor;   Set Shadow Color Self.iconView.layer.shadowOffset = Cgsizemake (20, 20); Set Shadow Deviation 2.2, KVC Way[Self.iconView.layer setvalue:@ ( -100) forkeypath:@ "transform.translation.x"]; What parameters can be passed, see the official documentation

Basic use of Calayer

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.