私は Xcode と Objectice C が初めてで、アプリの助けを借りたいと思います。ボタンに翻訳アニメーションをつけたい。たとえば、「ボタン」を X:30 Y:50 から X:10 Y:70 に移動するコードは何でしょうか? ありがとう :)。
10704 次
2 に答える
12
古いコンパイラ/iOS の場合:
// set the original frame
button.frame = CGRectMake(30, 50, 100, 100);
// animate to the new one
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:0.75];
button.frame = CGRectMake(10, 70, 100, 100);
[UIView commitAnimations];
新しいコンパイラ/iOS の場合:
// set the original frame
button.frame = CGRectMake(30, 50, 100, 100);
// animate
[UIView animateWithDuration:0.75 animations:^{
button.frame = CGRectMake(10, 70, 100, 100);
}];
于 2012-08-01T20:16:29.517 に答える
0
UIView (UIButton のスーパー クラス) にはアニメーション化する機能があり、次のようなものを使用します。
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:2];
CGAffineTransform transform = CGAffineTransformMakeTranslation(-20, 20);
[aButton setTransform:transform];
[UIView commitAnimations];
于 2012-08-01T20:18:44.917 に答える