私はCocos2Dゲームを開発しています。ステージでは、実行するタスクのリストをユーザーに提供するUIViewを表示します。アニメーションを使用して上下に移動するテキストフィールドがあります。私のコードは以下の通りです。commitAnimationを呼び出した後でもアニメーションがすべてのビューに影響しています
[textField setFrame:CGRectMake(textField.frame.origin.x, textField.frame.origin.y, textField.frame.size.width, textField.frame.size.height)];
[inviteButton setFrame:CGRectMake(inviteButton.frame.origin.x, inviteButton.frame.origin.y, inviteButton.frame.size.width, inviteButton.frame.size.height)];
[headingLabel setFrame:CGRectMake(headingLabel.frame.origin.x, headingLabel.frame.origin.y, headingLabel.frame.size.width, headingLabel.frame.size.height)];
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:0.3];
[UIView setAnimationDelegate:self];
[textField setFrame:CGRectMake(textField.frame.origin.x, textField.frame.origin.y-50, textField.frame.size.width, textField.frame.size.height)];
[inviteButton setFrame:CGRectMake(inviteButton.frame.origin.x, inviteButton.frame.origin.y-50, inviteButton.frame.size.width, inviteButton.frame.size.height)];
[headingLabel setFrame:CGRectMake(headingLabel.frame.origin.x, headingLabel.frame.origin.y-30, headingLabel.frame.size.width, headingLabel.frame.size.height)];
[UIView commitAnimations];
[self.view.layer removeAllAnimations];
問題は、ユーザーが実行されると、彼はスーパービューからこのビューを削除するにはキャンセルボタンを押した後でも、UIAlertViewとそのビューを削除した後、私のマップに登場する他のサブビューを含むすべてのビューは、アニメーションによって影響されるということです私は、テキストフィールドを移動し、ラベルを上下に移動するのに使用されました。 UIAlertViewは、同じAnimationを使用して表示しています。他のサブビューも同様です。誰がなぜこれが起こっているのか教えてもらえますか?
敬具あなたはbeginAnimations:context:
方法で一意の値にanimationID
を設定する必要が
私は解決策を得ました。ありがとうbasvk。私は実際に間違いをしていた。 UIコンポーネントのフレームを設定する前に[UIView commitAnimations]を呼び出していました。 – Aqueel