UIView rounded Corners setting

Source: Internet
Author: User

The simplest thing about UIView's fillet setting is that the layer's two properties are Cornerradius and Maskstobounds, but the Bezier curve is needed for setting one of the corners as rounded corners

UIView *aview = [[UIView alloc] init];

Aview.frame = CGRectMake (0, 0, 300, 200);

Aview.backgroundcolor = [Uicolor Redcolor];

[Self.view Addsubview:aview];

Set the desired fillet position and size uibezierpath *maskpath = [Uibezierpath bezierPathWithRoundedRect:aView.bounds byroundingcorners: Uirectcornerbottomleft | Uirectcornerbottomright Cornerradii:cgsizemake (10, 10)];

Cashapelayer *masklayer = [[Cashapelayer alloc] init];

Masklayer.frame = Aview.bounds;

Masklayer.path = Maskpath.cgpath;

AView.layer.mask = Masklayer;

where Uirectcornerbottomleft and Uirectcornerbottomright, is an enumeration, which also includes the upper left corner and the upper right corner
But there are times when you set the fillet so that it will take up a lot of resources for the application, so it's time to achieve a more troublesome Bezier curve.

UIView rounded Corners setting

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.