iOS画图 圆形裁剪

来源:互联网 发布:新申请域名无法访问 编辑:程序博客网 时间:2024/05/13 09:08

#import "SCHCircle.h"


@implementation SCHCircle



// Only override drawRect: if you perform custom drawing.

// An empty implementation adversely affects performance during animation.

- (void)drawRect:(CGRect)rect {

    // Drawing code

    

//    UIImage *img=[UIImage imageNamed:@"7.jpg"];

//    [img drawInRect:rect];

    

    

    CGContextRef ctx=UIGraphicsGetCurrentContext();

    CGContextAddEllipseInRect(ctx, rect);

    [[UIColorredColor] set];

    CGContextClip(ctx);//裁剪

    CGContextFillPath(ctx);

    

    

    

   UIImage *img=[UIImageimageNamed:@"7.jpg"];

    [imgdrawInRect:rect];


}



@end


0 0
原创粉丝点击