Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community!
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial

Nikki R
Courses Plus Student 100 PointsWhen tableview cell is tapped, I want to call didSelectRowAtIndextPath but when swiped I don't want it called
I have a custom UITableViewCell class with an UIImageView & UIScrollView taking up the full size of my tableviewcell. When user taps row, didSelectRowAtIndexPath is called, which I want. However, I also want to be able to horizontally swipe through my paging scrollview and not call didSelectRowAtIndexPath. All my delegates are set correctly for uiscrollview as commenting out
videoFrame.userInteractionEnabled = YES; // in the viewDidLoad of my tableViewCell subclass
(videoFrame is UIImageView on UITableView...it is behind, not within the UIScrollView)
I have tried
- (NSIndexPath *)tableView:(UITableView *)tableView willSelectRowAtIndexPath:(NSIndexPath *)indexPath
in my mainViewController but stuck as I still have to figure out how to differentiate between tapping and swiping. I cannot get the swipe gesture recognizer to work with my subclassed tableview cell. Independently, scrollview scrolls without need for swipe gesture recognizer but this feature is blocked if I'm allowing didSelectRowAtIndexPath or willSelectRowAtIndextPath to be called. I have to use either didSelectRowAtIndexPath or willSelectRowAtIndexPath instead of just a tap recognizer as I need to pass indexPath info when I tap row. Swiping is only for scrollview not for editing or loading another view controller. Any help would be greatly appreciated and I'm happy to share more code if necessary. storyboard:
View Hierarchy
->TableView
-->Custom Cell
---->Scroll View
--------->name label
--------->description label
--------->image view
---->page control
2 Answers

Amit Bijlani
Treehouse Guest TeacherYou need to use UIScrollViewDelegate
to determine if it is being pulled. Check out this video: Exploring Scroll Views
Also, you might have a better chance getting your question answered on StackOverflow since there is a larger pool of iOS developers.

Nikki R
Courses Plus Student 100 PointsAs stated in OP, I have my scrollView delegates set up correctly. I also first posted this on StackOverflow and after 8 hours of no response, decided to post on here. Please try to offer help.