ボタンは ではなく、UIButton
のサブクラスですUIControl
ユーザーが my をタップするUIControl
と、アルファを変更して、ユーザーが押されているという視覚的なフィードバックを得ることができるようにします。その後、リリース時に再度変更します
UIImageView *mask =[[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 58, 58)];
mask.image =[UIImage imageNamed:@"centerButton.png"];
mask.center = self.center;
mask.center = CGPointMake(mask.center.x, mask.center.y+3);
[self addSubview:mask];
中央のボタンは、カスタム コントロールの作成について学習するためのrayWenderlich.comのチュートリアルを使用して作成されました。
私は立ち往生しています。中央の画像を参照する方法がわかりません。
これが私の.hクラスです
@interface OOTRotaryWheel : UIControl
@property (weak) id <OOTRotaryProtocol> delegate;
@property (nonatomic, strong) UIView *container;
@property int numberOfSections;
@property CGAffineTransform startTransform;
@property (nonatomic, strong) NSMutableArray *sectors;
@property int currentSector;
@property (nonatomic, retain) UIImageView *mask;
- (id) initWithFrame:(CGRect)frame andDelegate:(id)del withSections:(int)sectionsNumber;
- (void)rotate;
- (void) buildSectorsEven;
- (void) buildSectorsOdd;
@end
では、UIImageView のタッチダウンとタッチアップを検出するにはどうすればよいでしょうか? ボタンのようにします(別のxibなどをロードできる場合)