2011-01-31 4 views
1

私はCGAffineTransformScaleを使ってUIImageViewのアニメーションを作りたいと思っています。アニメーションと共に、uiimageviewもそれを元に変更する必要があります。UIImageViewのアニメーションに問題がありますか?

、iは方法に従って書かれたように - {

imageV = [[UIImageView alloc] init]; 
imageV.frame = CGRectMake(0, 0, 768, 1024); 
imageV.contentMode = UIViewContentModeScaleToFill; 
[self.view addSubview:imageV]; 
imageV.image = [UIImage imageNamed:@"image.png"]; 
imageV.autoresizingMask = UIViewAutoresizingFlexibleWidth || UIViewAutoresizingFlexibleHeight; 

imageV.transform = CGAffineTransformScale(CGAffineTransformIdentity, 0.1, 0.1); 
[UIView beginAnimations:@"image animation" context:nil]; 
[UIView setAnimationDuration: 0.75];  
imageV.transform = CGAffineTransformScale(CGAffineTransformIdentity, 1.0, 1.0); 
[UIView commitAnimations]; 

[UIView beginAnimations:nil context:nil]; 
[UIView setAnimationDuration:.3]; 
imageV.transform = CGAffineTransformScale(CGAffineTransformIdentity,1.5, 1.5); 
[UIView commitAnimations]; 

}

をimageDidMoving(ボイド)が、それは働いていません。 私はまたCGAffineTransformScale代わりに、

CGRect frame2 = CGRectMake(70,70, 300, 600);    
    [UIView beginAnimations:nil context:nil]; 
    [UIView setAnimationDuration:1.0]; 
    imageView.frame = frame2; 
    [UIView commitAnimations]; 

を使用していますが、それはまた、動作していませんか?

NSTimerを使用せずにUIImageViewの起点を変更したり変更する方法はありますか?

答えて

-1
imageV.transform = CGAffineTransformScale(CGAffineTransformIdentity, 0.1, 0.1); 
[UIView beginAnimations:@"image animation" context:nil]; 
[UIView setAnimationDuration: 0.75];  
imageV.center = CGPointMake(65, 270); 
imageV.transform = CGAffineTransformScale(CGAffineTransformIdentity, 1.76, 1.24); 
[UIView commitAnimations];  
+0

ハードコーディングは決して解決策ではありません。 –

+0

はい、ご意見ありがとうございます。 – Tirth

関連する問題