About rounded corners of the UIView Class View in iOS

Source: Internet
Author: User

In iOS development, a rounded style is often required due to demand. If the 4 corners are rounded, it is good to say. A line of two lines of code can be done. But now I want to talk about irregular fillets. At the moment I have not found a better way to draw the fillet. I hope there is a solution to this article, the friend who wants to have a Can exchange study under.

1     Uibezierpath *maskpath = [Uibezierpath bezierPathWithRoundedRect:sourceView.bounds byroundingcorners: Uirectcornerbottomleft | Uirectcornertopleft Cornerradii:cgsizemake (55)]; 2     Cashapelayer *masklayer = [[Cashapelayer alloc] init]; 3     Masklayer.frame = sourceview.bounds; 4     Masklayer.path = Maskpath.cgpath; 5     SourceView.layer.mask = Masklayer;
  Claims to be the most elegant method of drawing an indefinite rounded view. Which fillet to draw on bezierpathwithroundedrect:byroundingcorners: Add the corresponding enumeration value to the method. (The left corner of the left side of the icon is cut in this way.):

For example, in this method, I drew a circle on the left and bottom left corner of the icon on the left.

Of course, although the code is elegant, the actual effect is not very good. After the value of cornerradii is set, you can cut out the borders of the Uitextfield and Uitextview views in the custom combo view. I can only use the method of covering the input box, To hide the left corner of the input box.

About rounded corners of the UIView Class View in iOS

Related Article

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.