UITapGestureRecognizer를 사용하여 ImageviewTap 작업을 처리합니다. 주된 ViewController에서는 훌륭하게 작동합니다. 하지만 내 APP에서 다른 ViewController를 사용하고 동일한 UITapRecognizer 코드를 복사 할 때 EXC_BAD_ACCESS 코드 = 1 주소를 얻습니다 : 0x80759d3a 내 이미지 뷰어에 인식기를 추가하면 줄에 오류 메시지가 표시됩니다. 내가 틀린 게 뭐야?UITapGestureRecognizer 오류, 이미지보기에 추가 할 때
내 이미지 뷰 : 그것은
UIImageView *live;
live = [[UIImageView alloc]initWithFrame:CGRectMake(92, 230, 136, 100)];
live.image = [UIImage imageNamed:@"online.png"];
[live addSubview:onlineLabel2];
[live setUserInteractionEnabled:YES];
[self.view addSubview:live];
[super viewDidLoad];
작동하고 내 제스처 인식기 :
UITapGestureRecognizer *singleTaP3 = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(onlineTap:)];
singleTaP3.numberOfTapsRequired = 1;
singleTaP3.numberOfTouchesRequired = 1;
[live addGestureRecognizer:singleTaP3];
과 마지막 줄은 내가 사고를 얻을.
먼저 [super viewDidLoad]를 호출해야합니다. 처음에는 코드를 추가합니다. – danypata