//會讓Mask圖的黑色部份被顯示,白色部份則會透明
//取得透明度遮罩的影像與大小
UIImage *maskImage = [UIImage imageNamed:@"alphaMask.png"];
CGRect rect = CGRectMake(0.0, 0.0, maskImage.size.width, maskImage.size.height);
//製作一個透明遮罩的Layer
CALayer *maskLayer = [[CALayer layer]retain];
maskLayer.bounds = rect;
maskLayer.contents = (id)maskImage.CGImage;
//將imageView中的影像做透明度的遮罩
[[middleViewController.view layer] setMask:maskLayer];
[maskLayer release];
沒有留言:
張貼留言