Mask Layer---iOS developing the nature of the layer of the View fillet attribute

Source: Internet
Author: User

Today I suddenly learned some basic UI properties before learning

is when we set the corner of the view

Let's say the following code

UIButton *button = [[UIButton alloc] Initwithframe:cgrectmake (Ten, Ten, ())];    Button.layer.masksToBounds = YES;    Button.layer.cornerRadius = 30;

This sets the Fillet property for the button

I used to write that layer is the level of the drawing of view.

Today I suddenly realized why write masktobounds this property is set to Yes

So, first of all, let's say that each control that inherits the view has a layer, which is a layer, which is actually a mask for the view. All the drawing is a layer equivalent to a painting of the paint and view is the canvas to show the layer of the container or view

And then today I learned that mask is the thing that we can set the mask layer to cover the layer, which seems a little abstract.

Is the mask layer when transparent, the layer will normally display the drawing style

When the mask layer is not transparent when placed above the layer of the mask layer is what shape layer will show what shape layer coating content

In fact, it can be understood as mask equivalent to clipping or lens shape, etc.

Remove the layer below the extra mask area with an opaque mask

So let's say the button above is set to Masktobounds==yes I understand that the mask layer has been set and given its own scope

The mask layer is then filtered to filter out the extra portions of the layer.

By setting the properties of the layer to set the fillet of the method to cut off the extra part so this time to get a circular button view is actually the layer is drawn as a circle through the mask cut filter ...

The above is my own for the experience of the summary if there is an opinion welcome to communicate

Mask Layer---iOS developing the nature of the layer of the View fillet attribute

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.