CAAffineTransformationMakeRotationに問題があります。 M ViewDidLoadで22.5度のUIViewを回転しようとしていて、1秒後にビューが画面に飛びます。CAAffineTransformationMakeRotationの問題
コードは次のとおりです。
-(void)ViewDidiLoad{
imgView1 = [[UIView alloc] initWithFrame:CGRectMake(20,150,.1,400)];
[imgView1 setBackgroundColor:[UIColor blackColor]];
[self.view addSubview:imgView1];
CGAffineTransform trans = CGAffineTransformMakeRotation(3.14159/8);
imgView1.transform = trans;
[self performSelector:@selector(img1_enter) withObject:nil afterDelay:1];
}
-(void)img1_enter{
CGRect frame = [imgView1 frame];
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:2.99];
frame.origin.x = 550;
[UIView commitAnimations];
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:2.99];
[imgView1 setFrame :frame];
[UIView commitAnimations];
}
問題は、このビューフライin..itsは、幅と高さが変化したときにということです。 Viewを回転させずに(AffineTransformationなしで)試してみましたが、正しく動作します。
ビューを回転する他の方法はありますか?
これはうまくいきません... – Hisenberg
CGAffineTransformationを使用すると、フレームの代わりに境界線を使用する必要があります。 使用方法を教えてください。 – Hisenberg
申し訳ありませんが、私は何が起こっているのかを間違って理解していました。私はちょうど境界/フレーム/ transormation - ものが実際に動作する方法を明確にすべき新しい答えを投稿しました。たくさん私の疑問を明確にするための –