//创建圆形遮罩,把用户头像变成圆形
/*
*CGPointMake(35, 35) 是绘图的中心点, 如果想把控件居中绘圆, 一般用控件的中心点, radius 是圆半径 startAngle是圆周 圆的一周就是2*m_pi
*/
// UIBezierPath* path = [UIBezierPath bezierPathWithArcCenter:CGPointMake(35, 35) radius:35 startAngle:0 endAngle:2 * M_PI clockwise:YES];
//创建圆角矩形遮罩,把用户头像变成圆角矩形
// UIBezierPath* path =[UIBezierPath bezierPathWithRoundedRect:self.d_teacherIcon.frame cornerRadius:10];
CGRect rect = self.d_teacherIcon.frame;// button ,imageView, label 等控件的尺寸
/*
*CGRectMake(0, 0, rect.size.width, rect.size.height) , 0,0 是绘图的左上角坐标, width, height 是绘图的宽高,10 是圆角
*/
UIBezierPath *path = [UIBezierPath bezierPathWithRoundedRect:CGRectMake(0, 0, rect.size.width, rect.size.height) cornerRadius:10];
CAShapeLayer* shape = [CAShapeLayer layer];
shape.path = path.CGPath;
self.d_teacherIcon.layer.mask = shape;