[英]Disable blending of UIView with its superview
I am creating say a rectangle in coregraphics - using CGContext functions in the - (void)drawRect:(CGRect)rect
method of UIView and adding it to a superview . 我创建说CoreGraphics在一个矩形-使用CGContext上功能于一体的
- (void)drawRect:(CGRect)rect
的UIView的方法,并将其添加到一个上海华 。 When i change the background of the superview , the color of the UIView blends with it. 当我更改超级视图的背景时, UIView的颜色会与之混合。 I want to disable this blending.
我想禁用此混合。
With some exploration( QuartzDemo Code of Apple) i finally found the answer to my problem. 经过一番探索(苹果的QuartzDemo代码),我终于找到了解决我问题的答案。 The color of the UIView was filled using [UIcolor color with R:G:B:Alpha] and the alpha was not 1.0.
UIView的颜色使用[UIcolor color with R:G:B:Alpha]填充,而Alpha不是1.0。
Also i used CGContextSetBlendMode(context, kCGBlendModeNormal);
我也使用
CGContextSetBlendMode(context, kCGBlendModeNormal);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.