UIButtons を循環形式で表示して、特定のUIButtonものをクリックすると中央の位置に移動する方法を教えてください。

クリートボタン:
double perAngle = 2 * M_PI / BUTTONS_COUNT;
for (int i = 0; i < BUTTONS_COUNT; i++) {
UIButton *btn = [[UIButton alloc] initWithFrame:CGRectMake(sin(perAngle * i) + basePoint.x, cos(perAngle * i) + basePoint.y, yourWidth, yourHeight)];
[btn addTarget:self action:@selector(moveButton:) forControlEvents:UIControlEventTouchUpInside];
[yourView addSubView:btn];
}
移動ボタン:
- (void)moveButton:(UIButton *)btn
{
[UIView animateWithDuration:2.0 animations:^{
btn.center = basePoint;
}];
}
これbasePointが円形の中心点です。これは単なるデモコードであり、movebackや例外などを処理する必要があります。
PS:このコードは完全な円形です。あなたのコードが半円形の場合は、自分で角度を計算する必要があります。簡単です。
使用するtouch recognition gestureか、単にカスタムを配置して、クリアカラーの背景を持つUIImageいくつかのカスタムを配置することができます。UIButton
その中央の画像については、選択したボタンに応じて画像を簡単に変更できます。UIImageView
編集:
解決策 2:
#import <QuartzCore/QuartzCore.h>
myButton.layer.cornerRadius = 8;
こちらの投稿もご覧ください。 iPhone SDKの画像としてサイズの丸いボタンを修正する