(빨간색 영역을 제거 이 예제)
iOS make part of an UIImage transparent과 "UIBezierPath bezierPathWithOvalInRect"의 도움으로 약간의 성공을 거두었지만 내 물건을 둘러싼 경로를 만들어 내고, 그것을 뒤집어서 내부와 외부를 만들어야합니다. 경로의 투명 ..
내가 올바른 결과를 얻을하려면 코드를 변경해야 할 경우 임 슈어하지 16,.. 여기
내 코드입니다 ://BezierPath
UIBezierPath *bezierPath = [UIBezierPath bezierPathWithOvalInRect:CGRectMake(0, 0, 100, 100)];
// Create an image context containing the original UIImage.
UIGraphicsBeginImageContext(_imgTemp.image.size);
[_imgTemp.image drawAtPoint:CGPointZero];
// Clip to the bezier path and clear that portion of the image.
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextAddPath(context,bezierPath.CGPath);
CGContextClip(context);
CGContextClearRect(context,CGRectMake(0,0,self._imgTemp.image.size.width,self._imgTemp.image.size.height));
// Build a new UIImage from the image context.
UIImage *newImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
self._imgTemp.image = newImage;
누구는 해결되었다?
은 검은 색이 투명하게 만 적색 투명하게 만들고 싶어 마십시오? –