您的当前位置:首页正文

ios 给View设置圆角

来源:图艺博知识网

给View设置圆角

设置之前必须将masksToBounds 设置为YES

例子:

self.mingView.layer.masksToBounds = YES;

// 需要显示为正圆

ornerRadius = View的宽度 / 2.0;并且View的宽和高必须相等

例子:

self.mingView.layer.cornerRadius = 50 / 2.0;

// 需要显示为圆角矩形 

ornerRadius = View的高度 / 2.0;

例子:

self.mingView.layer.cornerRadius = 80 / 2.0;

Top