关闭

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

标签: iOS图片旋转
485人阅读 评论(0) 收藏 举报
分类:
#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

0
0

查看评论
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
    个人资料
    • 访问:35707次
    • 积分:556
    • 等级:
    • 排名:千里之外
    • 原创:20篇
    • 转载:0篇
    • 译文:0篇
    • 评论:6条
    最新评论