美文网首页
给ImageView画圆角

给ImageView画圆角

作者: William_ | 来源:发表于2018-03-30 15:23 被阅读4次

    、、、

    UIImageView *imageview = [[UIImageView alloc] initWithFrame:CGRectMake(20, 100, 100, 100)];
    
    UIImage *anotherImage = [UIImage imageNamed:@"landscape.jpg"];
    
    UIGraphicsBeginImageContextWithOptions(imageview.bounds.size, NO, 1.0);
    
    [[UIBezierPath bezierPathWithRoundedRect:imageview.bounds cornerRadius:50] addClip];
    
    [anotherImage drawInRect:imageview.bounds];
    
    imageview.image = UIGraphicsGetImageFromCurrentImageContext();
    
    UIGraphicsEndImageContext();
    
    [self.view addSubview:imageview];
    

    、、、

    相关文章

      网友评论

          本文标题:给ImageView画圆角

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