设置图片圆角

2016-04-13  本文已影响36人  喵小帅
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];
上一篇 下一篇

猜你喜欢

热点阅读