iPhone中的剪切技巧:
1.获取图形上下文
2.构造剪切的路径(形状)
3.构建剪切区域
4.贴上你的画
- // 1
- CGContextRef context = UIGraphicsGetCurrentContext();
- // 2
- CGRect bounds = CGRectMake(0.0f, 0.0f, SIDELENGTH, SIDELENGTH);
- CGMutablePathRef path = CGPathCreateMutable();
- CGPathAddEllipseInRect(path, NULL, bounds);
- // 3
- CGContextAddPath(context, path);
- CGContextClip(context);
- // 4
- [LOGO drawInRect:bounds];