设置图片为圆形,加边框

UIImageView *imgView = [[UIImageView alloc] initWithFrame:CGRectMake(20, 80, 40, 40
)];
    imgView.image = [UIImage imageNamed:@"留言簿.png"];
    imgView.layer.masksToBounds=YES;
    imgView.layer.cornerRadius=40/2.0f; //设置为图片宽度的一半出来为圆形
    imgView.layer.borderWidth=3.0f; //边框宽度
    imgView.layer.borderColor=[[UIColor whiteColor] CGColor];//边框颜色
//    imgView.layer.anchorPoint = CGPointMake(0.5, 1)
    [self.view addSubview:imgView];
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容