قالب وردپرس درنا توس
Home / IOS Development / How do I add a touchGesture to a collectionView?

How do I add a touchGesture to a collectionView?




So this is nice. I use the method below for a table view and it works perfectly, but for some reason it is not called when used in a pool view. I set collectionView.delegate to myself. Anything else I can try? Remember that TableView and collectionView are in the same View Controller

  - (BOOL) gestureRecognizer: (UIGestureRecognizer *) gestureRecognizer shouldReceiveTouch: (UITouch *) touch {AppDelegate * mainDelegate = (AppDelegate *) [[UIApplication sharedApplication] delegate]; CGPoint point; CGPoint pointOnScreen; if ([mainDelegate.newsFeedContentLabel isEqualToString:@"3"]) {point = [touch locationInView:self.collectionView]; pointOnScreen = [self.collectionView convertPoint:point toView:nil]; } else {point = [touch locationInView:self.tableView]; pointOnScreen = [self.tableView convertPoint:point toView:nil]; } touchY = (int) pointOnScreen.y; touchX = (int) pointOnScreen.x; return NO; } 

posted by / u / fred_the_mailman
[comments]


Source link