【发布时间】:2012-10-01 19:54:54
【问题描述】:
按钮不是UIButton,它是UIControl的子类
当用户点击我的UIControl 时,我想更改 alpha,以便用户有一些视觉反馈,表明它被按下了。然后放开再改
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 上的a tutorial 创建的,用于了解如何创建自定义控件。
我被困住了。我不知道如何引用中心图像。
这是我的 .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 或其他东西时)
【问题讨论】:
标签: ios cocoa-touch alpha uicontrol