我在XCode 4上試過這個代碼,然後它就可以工作,但它甚至不會出現在iPhone 4真正的手機上。iPhone 4上的動畫不同於模擬器
UIImage *myimage = [UIImage imageNamed:@"2-2.PNG"];
UIImageView *myimageView =[[UIImageView alloc] initWithImage:myimage];
myimageView.frame = CGRectMake(15, 15, 20, 20);
CABasicAnimation *animation = nil;
CATransform3D transform;
animation = [CABasicAnimation animationWithKeyPath:@"transform"];
transform = CATransform3DMakeRotation(1.57f, 0.0f, 1.0f, 0.0f);
NSValue* value = [NSValue valueWithCATransform3D:transform];
[animation setToValue:value];
[animation setAutoreverses:YES];
[animation setDuration:0.5f];
[animation setRepeatCount:2.0];
[[myimageView layer] addAnimation:animation forKey:@"180"];
[self.view addSubview:myimageView];
任何幫助我應該如何使它在真正的手機上工作?
嘗試'UIImage * myimage = [UIImage imageNamed:@「2-2.png」];' – 2012-02-22 10:11:37