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