标签:
原图,为正方形
就是给图片的cornerRadius设置为图片宽度的一半
#define imgViewW 150 UIImageView *imgView = [[UIImageView alloc]initWithFrame:CGRectMake(50, 100, imgViewW, imgViewW)]; imgView.image = [UIImage imageNamed:@"head"]; [self.view addSubview:imgView]; //设为圆形 imgView.layer.masksToBounds = YES; imgView.layer.cornerRadius = imgViewW/2;
效果图
标签:
原文地址:http://www.cnblogs.com/Apologize/p/4989193.html