美文网首页
iOS 切圆角

iOS 切圆角

作者: 时光浅影 | 来源:发表于2018-05-02 15:40 被阅读6次
    //初始化一个图片视图
    UIImageView * view = [[UIImageView alloc] init];
    
    CGRect rect = view.bounds;
    CGSize size = rect.size;
    
    UIGraphicsBeginImageContextWithOptions(size, NO, 0.0);
    
    [[UIBezierPath bezierPathWithRoundedRect:rect cornerRadius:size.width] addClip];
    
    [view drawRect:rect];
    
    view.image = UIGraphicsGetImageFromCurrentImageContext();  
    
    UIGraphicsEndImageContext();
    

    相关文章

      网友评论

          本文标题:iOS 切圆角

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