-3

クリックするとUIButtonを動かしたいと思います....基本的にはアニメーション化するのと同じです。ボタンをクリックすると、現在の位置から上に移動し、別のボタンをクリックすると下に移動する必要があります。私はiOSの初心者なので、誰か助けてください。前もって感謝します

4

2 に答える 2

0

[ボタン ターゲット メソッド] で、ボタン フレームを変更して位置を変更します。

-(void)btnAction:(id)sender
{
UIButton *btn = (UIButton *)sender;
CGRect newFrame = <Frame to change position>

[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:1.0f];
[btn setFrame:newFrame];
[UIView commitAnimations];
}
于 2013-10-17T08:52:58.367 に答える