私はこの髪を引っ張る問題を抱えています。誰かが私を助けてくれることを願っています. ちょっとしたことのようですが、解決策を見つけることができませんでした。
アニメーション ブロックで移動したい UIButton があります。ボタンをクリックするたびに、新しい場所に移動します。ボタンは常に正しい場所に移動します。問題は、常に最初の場所から新しい場所に移動することです。
私がボタンを持っているとしましょう(0,0)
。(0,50)
今、私はボタンをに移動したいのですが、それ(0,100)
がアニメーション化(0,50)
するの(0,100)
は何ですか?(0,0)
(0,100)
UIButton
アニメーション ブロックに新しいフレームを設定して移動します
[UIView animateWithDuration:0.5f
delay:0.0f
options:UIViewAnimationCurveLinear
animations:^{
}
completion:nil];
私の場合、他のコントロールの移動が完了したら、ボタンを完了ブロックに移動します。
誰かが私が話していることを正確に知っていて、私に答えてくれることを本当に願っています。
uibutton をアニメーション化するために使用するコードはこれです。ボタンの名前は「btnAddPhoneNumber」で、「送信者」でもあります。
[UIView animateWithDuration:1
delay:0
options:UIViewAnimationCurveLinear
animations:^{
txtNewPhoneNumber.frame = CGRectMake(newXnumber, newYnumber, txtPhoneNumber.frame.size.width, txtPhoneNumber.frame.size.height);
}
completion:^(BOOL finished) {
txtNewPhoneNumber.placeholder = @"here you go!";
//animate add textfield button.
[UIView animateWithDuration:0.5f
delay:0
options:UIViewAnimationCurveLinear
animations:^{
[sender setFrame:CGRectMake(btnAddPhoneNumber.frame.origin.x, newYnumber, btnAddPhoneNumber.frame.size.width, btnAddPhoneNumber.frame.size.height)];
txtNewPhoneNumberTitle.frame = CGRectMake(newXtitle, newYtitle, txtPhoneNumberTitle.frame.size.width, txtPhoneNumberTitle.frame.size.height);
[btnDelete setFrame:btnDeleteRect];
}
completion:^(BOOL finished) {
}];
}];
私の質問を読んでいただき、解決策を見つけていただきありがとうございます。
EDIT(コード例を追加)