Picture used for mask matte effect with Resizableimage
Effect:
A picture used as a material:
Source:
////VIEWCONTROLLER.M//Rect////Created by youxianming on 15/3/29.//Copyright (c) 2015 youxianming. All rights reserved.//#import "ViewController.h"@interfaceViewcontroller ()@end@implementationViewcontroller- (void) viewdidload {[Super viewdidload]; //Background MapUiimageview *bgview = [[Uiimageview alloc] initwithimage:[uiimage imagenamed:@"Psb.jpeg"]]; Bgview.frame= CGRectMake (0,0, BgView.frame.size.width/2. F, BgView.frame.size.height/2. f); Bgview.center=Self.view.center; [Self.view Addsubview:bgview]; //A picture used as a maskUIImage *maskimage = [UIImage imagenamed:@"rect_new"]; Maskimage= [Maskimage Resizableimagewithcapinsets:uiedgeinsetsmake ( -, -, -, -) Resizingmode:uiimageresizingmodetile]; //View as MaskUiimageview *maskview = [[Uiimageview alloc] Initwithframe:cgrectmake (0,0, -, -)]; Maskview.image=Maskimage; Bgview.maskview=Maskview; //Performing animations[Uiimageview animatewithduration:3. F animations:^{maskview.frame=Bgview.bounds; }];}@end
Details to be aware of:
This is very convenient for making the alpha channel gradient effect.
Picture used for mask matte effect with Resizableimage