Reputation: 9541
@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
In my .m file
my init method
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);
UITapGestureRecognizer *singleTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(buttonPressedDown:)];
[mask addGestureRecognizer:singleTap];
[mask setMultipleTouchEnabled:YES];
[mask setUserInteractionEnabled:YES];
-(IBAction)buttonPressedDown
{
//Connect this IBAction to touchDown
mask.alpha = 0.5f;
NSLog(@"tapping the center of the earth");
}
When I tap the image, it crashes with this message
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[OOTRotaryWheel buttonPressedDown:]: unrecognized selector sent to instance 0x71724e0'
*** First throw call stack:
I drew my UI programmatically so there are no UI elements in Interface Builder. My UI is a storyboard but it's empty.
Upvotes: 0
Views: 407
Reputation: 104082
You forgot the colon in your implementation of buttonPressedDown:. Either get rid of the colon in the action parameter of your singleTap definition, or add the colon and the argument to your implementation.
Upvotes: 2