2014-05-23 4 views
0

이 버튼에서 어떻게 동작 이벤트를 얻을 수 있습니까?scrollView의 버튼이 동작 이벤트를 잃었습니다.

self.scrollView = [[UIScrollView alloc] initWithFrame:self.view.bounds]; 
[self.view addSubview:self.scrollView]; 

UIButton *backButton = [UIButton buttonWithType:UIButtonTypeCustom]; 
backButton.frame = CGRectMake(0, 0, 32, 32); 
backButton.adjustsImageWhenHighlighted = YES; 
[backButton setImage:backButtonImage forState:UIControlStateNormal]; 
[backButton addTarget:self action:@selector(backButtonAction:) forControlEvents:UIControlEventTouchUpInside]; 
[_scrollView addSubview:backButton]; 

답변

0

코드가 좋습니다. 그것은 소위 scroolView에 대한 userInteractionEnabled을 확인하고

_scrollView.userInteractionEnabled = YES; 
YES로 설정하지 않을 경우이 기능

- (void)backButtonAction:(id)sender 
{ 
    NSLog(@"backButton pressed"); 
} 

를 구현

관련 문제