Hi i have made a function in which you can pass 2 UIImages and it will mask with the transparent Image
like
Here completeSingleView is a UIView.
Reference is taken from
http://stackoverflow.com/questions/5757386/how-to-mask-an-uiimageview
like
- (UIImageView*) maskImage:(UIImage *)image withMask:(UIImage *)maskImage {
UIImageView *imageView = [[UIImageView alloc] initWithImage:image];
CALayer *mask1 = [CALayer layer];
mask1.contents = (id)[maskImage CGImage];
mask1.frame = CGRectMake(0, 0, 1024, 768);
imageView.layer.mask = mask1;
imageView.layer.masksToBounds = YES;
return imageView;
}
Its returns the UIImageView, which you can add directly in UIView. You can call this method like following:
UIImage *image = [UIImage imageNamed:@"screenFull.png"];
UIImage *mask = [UIImage imageNamed:@"screen_mask.png"];
[self.completeSingleView addSubview:[self maskImage:image withMask:mask]];
Reference is taken from
http://stackoverflow.com/questions/5757386/how-to-mask-an-uiimageview
Keep on writing, great job!
ReplyDelete