谢谢你的帮助.
VIEwController.h
#import <UIKit/UIKit.h> @interface VIEwController : UIVIEwController { IBOutlet UIImageVIEw *theImageVIEw; IBOutlet UIbutton *thebutton; NSTimer *theTimer; float angle; BOol runStop; } @property (atomic,retain) IBOutlet UIImageVIEw *theImageVIEw; @property (atomic,retain) IBOutlet UIbutton *thebutton; -(IBAction)runRoulette:(ID)sender; @end
VIEwController.m
#import "VIEwController.h"@interface VIEwController ()@end@implementation VIEwController@synthesize thebutton,theImageVIEw;- (voID)vIEwDIDLoad{ angle = 0; runStop = FALSE; [super vIEwDIDLoad]; // Do any additional setup after loading the vIEw,typically from a nib.}- (voID)dIDReceiveMemoryWarning{ [super dIDReceiveMemoryWarning]; // dispose of any resources that can be recreated.}-(voID)rotateRoulette{ theImageVIEw.center = CGPointMake(self.theImageVIEw.center.x,self.theImageVIEw.center.y); theImageVIEw.transform=CGAffinetransformMakeRotation (angle); angle+=0.001;}-(IBAction)runRoulette:(ID)sender{ if(!runStop) { theTimer = [NSTimer scheduledTimerWithTimeInterval:1.0/600.0 target:self selector:@selector(rotateRoulette) userInfo:nil repeats:YES]; } else { [theTimer invalIDate]; theTimer = nil; } runStop = !runStop;}@end解决方法 我找到了一种非常简单的方法来让我的动画工作我也想要它 –
theImageVIEw.center = CGPointMake(160.0,364.0);[UIVIEw beginAnimations:nil context:NulL];[UIVIEw setAnimationDuration:5];//theImageVIEw.center=CGPointMake(self.theImageVIEw.center.x,self.theImageVIEw.center.y);theImageVIEw.transform = CGAffinetransformMakeRotation(M_PI/2.65);[UIVIEw commitAnimations];
它旋转theImageVIEw M_PI / 2.65(M_PI / 2.65是roataion数量),计数为5.
总结以上是内存溢出为你收集整理的旋转动画xcode iphone全部内容,希望文章能够帮你解决旋转动画xcode iphone所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)