0
이 코드가 있는데보기에 아무 것도 추가하지 않습니다. 무엇이 잘못 되었나요? 필자는 이미지 파일러를 적용 할 예정이지만, 나중에이 작업을 완료하면 나중에 나올 것입니다.하지만 필자가 필터를 추가하려고하면 이것이 잘못된 접근인지 알려주십시오.objective-c - 코어 그래픽을 사용하여 UIImage 만들기
UIGraphicsPushContext(context);
CALayer *layer = [CALayer layer];
CGColorRef bgColor = [UIColor colorWithHue:0.6 saturation:1.0 brightness:1.0 alpha:1.0].CGColor;
layer.frame = CGRectMake(0, 0, 200, 200);
CGContextSetFillColorWithColor(context, bgColor);
CGContextFillRect(context, layer.bounds);
CGContextSaveGState(context);
CGColorSpaceRef patternSpace = CGColorSpaceCreatePattern(NULL);
CGContextSetFillColorSpace(context, patternSpace);
CGColorSpaceRelease(patternSpace);
CGContextFillRect(context, layer.bounds);
CGContextRestoreGState(context);
UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
UIImageView *borrar = [[UIImageView alloc]initWithImage:image];
[self.view addSubview:borrar];