在纸上制作kCGBlendModeMultiply

时间:2015-11-24 17:41:21

标签: ios objective-c blending

我有这张照片:

I have this picture

我想将UIImageView添加为子视图,我希望图片在背景中“弯曲”。

我想我必须使用kCGBlendModeMultiply

有任何想法如何解决这个问题?

1 个答案:

答案 0 :(得分:1)

您可以创建UIView的子类并覆盖drawRect。

例如,我创建了一个名为CrinkedView的子类。 .h看起来像这样:

#import "CrinkedView.h"

@implementation CrinkedView

-(void)setCrinkedImage:(UIImage *)crinkedImage
{
    _crinkedImage = crinkedImage;
    [self setNeedsDisplay];
}


- (void)drawRect:(CGRect)rect {
    [[UIImage imageNamed:@"vI745.jpg"] drawInRect:self.bounds];
    if (self.crinkedImage) {
        [self.crinkedImage drawInRect:self.bounds blendMode:kCGBlendModeMultiply alpha:1.0];
    }

}


@end

.m就像这样:

204: has no json response, but need to treat as success
406: should redirect to sign in
422: has json for error message
< 400 (but not 204): success, will have json
>= 400 (but not 422): error, will not have json