在view扣除正方形

时间:2014-04-29 13:33:22   收藏:0   阅读:284
- (void)drawRect:(CGRect)rect
{
    [super drawRect:rect];
    CGContextRef ctx = UIGraphicsGetCurrentContext();
    CGContextSetRGBFillColor(ctx, .3, .3, .3, .1);
    CGContextFillRect(ctx, self.bounds);
    
    CGContextSetStrokeColorWithColor(ctx, [UIColor whiteColor].CGColor);
    CGContextStrokeRectWithWidth(ctx, _clearRect, 2);
    
    CGContextClearRect(ctx, _clearRect);
}
项目中遇到一个遮罩层的问题,整个view浅灰色中间一块为透明色,能看到下面view上显示的内容!

在view扣除正方形,码迷,mamicode.com

评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!