我听说可以用黑/白图像遮蔽视图,其中黑色表示完全透明,白色表示视图是可见的。与clipsToBounds最大的不同之处在于,视图可以被裁剪成有趣的形状,比如圆形或星形。我怎么能这么做呢?
发布于 2012-04-22 00:40:32
CGImageRef maskImage = <Black-White Image>
const CGFloat components[6] = {0,0,0,0,0,0}; // mask black color
CGImageRef mask = CGImageCreateWithMaskingColors(maskImage, components);
CGContextClipToMask(ctx, mask)
// draw images will be maskedhttps://stackoverflow.com/questions/2577978
复制相似问题