2012-10-02 2 views
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 

를 추가 할 때UIImageView에 충돌 내하는 .m 파일에서 UITapGestureRecognizer

나는 이미지를 탭하면 내 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가 프로그래밍 방식으로 인터페이스 빌더에는 UI 요소가 없습니다. 내 UI는 스토리 보드이지만 비어 있습니다.

답변

2

buttonPressedDown :을 구현할 때 콜론을 잊어 버렸습니다. singleTap 정의의 action 매개 변수에서 콜론을 없애거나 구현에 콜론과 인수를 추가하십시오.

+0

touchUpEvent를 어떻게 등록합니까? UIImage가 더 이상 터치되지 않을 때 알파를 변경하고 싶습니다. –

+0

싱글탭이하는 일입니다. "탭"은 터치 다운으로 이어지는 터치입니다. 따라서 buttonPressedDown에 대한 호출은 터치 할 때까지 발생하지 않습니다. – rdelmar

관련 문제