Tôi đã thiết lập một UITapGestureRecognizer trên viewDidLoad của bộ điều khiển xem của tôi nhưng bằng cách nào đó nó kích hoạt phương thức chọn hai lần cho một lần chạm.UIGestureRecognizer kích hoạt hai lần?
UITapGestureRecognizer *g = [[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(openInMapsApp:)] autorelease];
[self.mapView addGestureRecognizer:g];
phương pháp của tôi:
-(void)openInMapsApp:(UIGestureRecognizer*)g {
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@""
message:@"This will open this location in the Maps application. Continue?"
delegate:self
cancelButtonTitle:@"Cancel"
otherButtonTitles:@"OK",nil];
[alertView show];
[alertView release];
}
Có thể điều này sẽ xảy ra chỉ trong một thời gian? –