美文网首页iOS Play
设置图片为圆形,加边框

设置图片为圆形,加边框

作者: tianheng | 来源:发表于2017-05-03 16:37 被阅读43次
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];

相关文章

网友评论

    本文标题:设置图片为圆形,加边框

    本文链接:https://www.haomeiwen.com/subject/wqfltxtx.html