Implicit animation (finger-dragging layer)
#import "HMViewController.h"@interfaceHmviewcontroller () @property (nonatomic, weak) Calayer*layer;@end@implementationHmviewcontroller- (void) viewdidload{[Super Viewdidload]; //additional setup after loading the view, typically from a nib.Calayer*layer =[Calayer layer]; //Set DimensionsLayer.bounds = CGRectMake (0,0, -, -); //ColorLayer.backgroundcolor =[Uicolor Redcolor]. Cgcolor; [Self.view.layer Addsublayer:layer]; _layer=layer; }- (void) Touchesbegan: (Nsset *) touches withevent: (Uievent *)Event{ //Get Touch PointUitouch *touch =[touches anyobject]; Cgpoint POS=[Touch LocationInView:self.view]; //Open Transaction//[catransaction begin]; //Cancel hidden Animation//[Catransaction Setdisableactions:yes];//_layer.position = cgpointmake (100, 100); //Set Border_layer.borderwidth = Arc4random_uniform (5) +1; CGFloat R= Arc4random_uniform ( the) /255.0; CGFloat g= Arc4random_uniform ( the) /255.0; CGFloat b= Arc4random_uniform ( the) /255.0;//_layer.bordercolor = [Uicolor colorwithred:r green:g blue:b alpha:1]. Cgcolor; //Set Background color_layer.backgroundcolor = [Uicolor colorwithred:r green:g blue:b Alpha:1]. Cgcolor; //set the fillet radius_layer.cornerradius = Arc4random_uniform ( -); //Set Location_layer.position =POS; //Commit a transaction//[Catransaction commit];}@end
iOS 18th day (3,calayer implicit animation)