IOS开发之为视图绘制单(多)个圆角实例代码
程序员文章站
2024-02-16 20:04:04
ios开发之为视图绘制单(多)个圆角实例代码
前言:
为视图绘制圆角,圆角可以选左上角、左下角、右下角、右上角、全部圆角
//core raduias...
ios开发之为视图绘制单(多)个圆角实例代码
前言:
为视图绘制圆角,圆角可以选左上角、左下角、右下角、右上角、全部圆角
//core raduias uiview *actionview = [[uiview alloc]initwithframe:cgrectmake(0, 0, 200, 200)]; uibezierpath *maskpath = [uibezierpath bezierpathwithroundedrect:actionview.bounds byroundingcorners:uirectcornertopright | uirectcornerbottomright cornerradii:cgsizemake(20, 20)]; cashapelayer *masklayer = [[cashapelayer alloc] init]; masklayer.frame = actionview.bounds; masklayer.path = maskpath.cgpath; actionview.layer.mask = masklayer;
uirectcorner枚举值如下:
typedef ns_options(nsuinteger, uirectcorner) { uirectcornertopleft = 1 << 0, uirectcornertopright = 1 << 1, uirectcornerbottomleft = 1 << 2, uirectcornerbottomright = 1 << 3, uirectcornerallcorners = ~0ul };
感谢阅读,希望能帮助到大家,谢谢大家对本站的支持!