iphone在drawRect中使用Quart2D api有1px冗余行吗?

iphone在drawRect中使用Quart2D api有1px冗余行吗?

问题描述:

我使用Quart2D绘制矩形,但不能按我的想法工作。iphone在drawRect中使用Quart2D api有1px冗余行吗?

我的如下代码:

-(void) drawRect:(CGRect)rect{ 
[[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); 
} 

在一个空白的项目运行演示,一切工作正常:

enter image description here

但在5月的项目,我得到1个PX符合不同alpha值:

enter image description here

它需要我几个小时才能调试..我将不胜感激谁给我一个答案:)

问题已解决。

这两个矩形的值应该是int而不是浮点数