【初学】iOS学习笔记-图片旋转

来源:互联网 发布:淘宝图片专业拍摄 编辑:程序博客网 时间:2024/04/30 05:23
#import "ITViewController.h"@interface ITViewController ()@property (strong,nonatomic)UIImageView *img;@end@implementation ITViewController@synthesize img;- (void)viewDidLoad{    [super viewDidLoad];// Do any additional setup after loading the view, typically from a nib.    self.view.backgroundColor=[UIColor grayColor];         img=[[UIImageView alloc]initWithFrame:CGRectMake(self.view.frame.size.width/2-32, self.view.frame.size.height/2-32, 64.0f, 64.0f)];    [img setImage:[UIImage imageNamed:@"页面跳转加载.png"]];    [self.view addSubview:img];    [NSTimer scheduledTimerWithTimeInterval:0.1 target:self selector:@selector(bianxing) userInfo:nil repeats:YES];    }-(void)bianxing{    static float i=1.0f;    if(i==13.0f)    {        i=1;    }    [img setTransform:CGAffineTransformMakeRotation(M_PI*2*(30*i)/360.0f) ];    i++;    }- (void)didReceiveMemoryWarning{    [super didReceiveMemoryWarning];    // Dispose of any resources that can be recreated.}@end