The button is not a UIButton, it’s a subclass of UIControl
When the user taps my UIControl, I want to change the alpha so the user has some visual feedback that it’s being pressed. Then change it again when released
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];
The center button was created using a tutorial on rayWenderlich.com for learning about creating custom controls.
I’m stuck. I can’t figure out how to reference the center image.
Here is my .h class
@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
So how do I detect a touch down on the UIImageView and touch up? and make it more like a button (so when i can load another xib or something)
To change the alpha use:
mask.alpha = 0.0f;To do this with
IBActions:To act when the button is pressed:
To change the button back to it’s original Alpha:
To do this with
UITouches:To act when the button is pressed:
To change the button back to it’s original Alpha:
This will work, wether you have a xib/storyboard interface or not.