Tag:calayer animated
calayertransformviewcontroller.m//calayertransformcontroller////Created by Xiaoyao on 15/3/10.//Copyright (c ) 2015 Lijien. All rights reserved.//#import "CALayerTransformViewController.h" #define Photo_heoght 150@interface Calayertransformviewcontroller () @end @implementation calayertransformviewcontroller-(void) ViewDidLoad {[Super Viewdidload]; [Self calayerandtransform];} -(void) Calayerandtransform {//Shadow layer Calayer *shadowlayer = [[Calayer alloc] init]; Shadowlayer.bounds = CGRectMake (0, 0, photo_heoght, photo_heoght); Shadowlayer.position = Cgpointmake (160, 200); Shadowlayer.cornerradius = PHOTO_HEOGHT/2; Shadowlayer.shadowcolor = [Uicolor Graycolor]. Cgcolor; shadowlayer.shadowopacity = 1; Shadowlayer.shadowoffset = Cgsizemake (2, 1); Shadowlayer.borderwidth = 2; Shadowlayer.bordercolor = [Uicolor Whitecolor]. Cgcolor; [Self.view.layer Addsublayer:shadowlayer]; Deformation layer Calayer *layer = [[Calayer alloc] init]; Layer.bounds = Shadowlayer.bounds; LaYer.position = shadowlayer.position; Layer.backgroundcolor = [Uicolor Redcolor]. Cgcolor; Layer.cornerradius = Shadowlayer.cornerradius; Layer.maskstobounds = YES; Layer.bordercolor = [Uicolor Whitecolor]. Cgcolor; Layer.borderwidth = Shadowlayer.borderwidth; [Self.view.layer Addsublayer:layer]; Solve the inverted image problem Layer.transform = Catransform3dmakerotation (m_pi, 1, 0, 0); Layer.delegate = self; [Layer Setneedsdisplay];} -(void) Drawlayer: (Calayer *) layer Incontext: (cgcontextref) ctx {UIImage *image = [UIImage imagenamed:@ "Photo.png"]; Cgcontextdrawimage (CTX, cgrectmake (0, 0, Photo_heoght, photo_heoght), image. Cgimage);} @end
Calaer Deformation and shadows