设置图片圆角

UIImageView *imageView=[[UIImageView alloc]initWithFrame:CGRectMake(100, 100, 100, 100)];
    
    imageView.image=[UIImage imageNamed:@"8]Q_K%3RKSEU)W4BB2ZP6GF.jpg"];
    //开始对imageview进行画图
    UIGraphicsBeginImageContextWithOptions(imageView.bounds.size, NO, 1.0);
    //使用贝塞尔曲线画出一个圆形图
    [[UIBezierPath bezierPathWithRoundedRect:imageView.bounds cornerRadius:imageView.frame.size.width] addClip];
    [imageView drawRect:imageView.bounds];
    
    imageView.image=UIGraphicsGetImageFromCurrentImageContext();
    //结束画图
    UIGraphicsEndPDFContext();
    [self.view addSubview:imageView];

你可能感兴趣的:(设置图片圆角)