0
@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

私の.mファイル

私のinitメソッド

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");
}

画像をタップすると、このメッセージでクラッシュします

*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[OOTRotaryWheel buttonPressedDown:]: unrecognized selector sent to instance 0x71724e0'
*** First throw call stack:

UIをプログラムで描画したので、InterfaceBuilderにUI要素はありません。私のUIはストーリーボードですが、空です。

4

1 に答える 1

2

buttonPressedDown:の実装でコロンを忘れました。singleTap定義のactionパラメーターのコロンを削除するか、コロンと引数を実装に追加します。

于 2012-10-02T18:50:14.130 に答える