#import "ViewController.h" @interface Viewcontroller () @property (Strong, nonatomic) UILabel *label;@ End@implementation viewcontroller-(void) viewdidload {[Super viewdidload]; Additional setup after loading the view, typically from a nib. CGRect labelframe = CGRectMake (100, 100,100, 50); Self.label = [[UILabel alloc] initwithframe:labelframe]; Self.label.font = [Uifont fontwithname:@ "Helvetica" size:36]; Self.label.text = @ "XxxX"; Self.label.textAlignment = Nstextalignmentcenter; Self.label.backgroundColor = [Uicolor Browncolor]; [Self.view AddSubview:self.label]; [Self rotatelabeldown];} -(void) rotatelabeldown{[UIView animatewithduration:10 animations:^{self.label.layer.anchorPoint = Cgpointmake (0.5, 0.5); Self.label.transform = cgaffinetransformmakerotation (-90); Counterclockwise Rotation self.label.transform = cgaffinetransformmakerotation (M_PI); } completion:^ (BOOL finished) {[Self rotatelabelup]; }];} -(void) Rotatelabelup{[UIView animatewithduration:10 animations:^{self.label.layer.anchorPoint = cgpointmake (0.5, 0.5); Self.label.transform = cgaffinetransformmakerotation (0); } completion:^ (BOOL finished) {[Self rotatelabeldown]; }];} -(void) didreceivememorywarning {[Super didreceivememorywarning]; Dispose of any resources the can be recreated.} @end
iOS implementation rotation