カスタムUIButtonのタイトルにアニメーションを配置して、番号(各タイトルはランダムに割り当てられた番号を示します)が回転するようにします。どうやってやるの?
問題は、数字の画像を反転させてこれを行いたくないということです。他に方法はないかと思います。
flipLabelButton
ビューコントローラに接続されているというボタンがあるとすると、IBOutlet
このコードを使用して、ボタンを新しいラベルにアニメーション化できます。
- (IBAction)flipLabelText:(id)sender {
NSString *newText = [NSString stringWithFormat:@"%d", rand() % 100];
[UIView beginAnimations:@"flipbutton" context:NULL];
[UIView setAnimationDuration:1.0];
[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromRight forView:self.flipLabelButton cache:YES];
[self.flipLabelButton setTitle:newText forState:UIControlStateNormal];
[UIView commitAnimations];
}