现在的位置: 首页 > 综合 > 正文

将一个小图片平铺到大范围内

2014年02月21日 ⁄ 综合 ⁄ 共 427字 ⁄ 字号 评论关闭

CGContextRef context = UIGraphicsGetCurrentContext();

    CGContextSaveGState(context);

    

    CGRect bounds = self.bounds;

    

    UIBezierPath * path = [UIBezierPath
bezierPathWithRect:bounds];

    

    CGContextAddPath(context, [path
CGPath
]);

    CGContextClip(context);

    

    CGContextSetBlendMode(context,
kCGBlendModeMultiply);

    UIImage * noise = [UIImage
imageNamed:@"noise-tile.png"];

    [noise drawAsPatternInRect:bounds];

    

    CGContextRestoreGState(context);

抱歉!评论已关闭.