1
我想用其它視圖一個UIView申請飽和的BlendMode,像這樣:iOS的7/8目標C - 適用的BlendMode到的意見
:例
我有一個UILabel和的UIImageView在我的ViewController視圖中,加上一個覆蓋drawRect
方法的BlendView。
- (void) drawRect:(CGRect)area
{
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextSaveGState(context);
[[UIColor whiteColor] setFill];
CGContextSetBlendMode(context, kCGBlendModeSaturation);
CGContextFillRect(context, self.bounds);
CGContextRestoreGState(context);
}
不過,我只有當kCGBlendModeSaturation
被賦予一個黑色的正方形,如果kCGBlendModeMultiply
給一個白色正方形 - 沒有應用的BlendMode。 我已經將BlendView設置爲不透明,並使用不同的alpha值進行測試,無需更改。
P.S .:我希望blendmode應用於任何視圖,而不僅僅是圖像。
謝謝您的回覆,我認爲這樣做也是不可能的,但對此不確定。 但是,是否可以覆蓋ViewController的'.view'並重寫它的'drawRect'方法並應用blendmode?如果是,那又如何? – Tot 2014-11-14 16:23:51