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

#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

阅读更多
文章标签: iOS 图片旋转
个人分类: iOS开发
上一篇【初学】UI控件学习笔记-UIActivityIndicatorView活动指示器
想对作者说点什么? 我来说一句

解决ios拍照上传图片被旋转

2016年11月21日 78KB 下载

没有更多推荐了,返回首页

关闭
关闭