原图,为正方形

就是给图片的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;

效果图

posted on 2015-11-23 17:58  lixin327  阅读(467)  评论(0编辑  收藏  举报