问题描述
代码如下
-(void) drawRect:(CGRect)rect{//CGContextRef context = UIGraphicsGetCurrentContext();//CGContextSetRGBFillColor(context, 0.0, 0.0, 0.0, 0.2);[[UIColor colorWithRed:0.0 green:0.0 blue:0.0 alpha:0.2]setFill];CGRect grayRect = self.frame;UIRectFill(grayRect);CGRect cropRect = _intersectionRect;CGRect intersectionRect = CGRectIntersection(cropRect, grayRect);[[UIColor clearColor]setFill];UIRectFill(intersectionRect);}
在空白项目的Demo中,一切ok
但是在我自己的项目中,有多余的1px,透明度不同的边框,请问怎么解决?
问题解答
回答1:问题解决,两个rect的值应该都设置为int而不是float。