I want to make a profile viewcontroller something similar to Twitter. I believe it contains 3 different child UITableviewController
which keeps switching by segmented control. But when I scroll my tableview of child viewController it scrolls the parent scroll view as well.
Can anybody explain how to achieve that behavior?
I know your problem exactly. Problem is, Twitter is not an example, Snapchat however is....
You have a root View Controller that embeds a UIScrollView (Subclassed). Inside this subclass, you want to override the gesture recognizers like so...
-(BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer {
if (gestureRecognizer.state != 0 && otherGestureRecognizer.state != 1)
{
return YES;
} else {
return NO;
}
}
Now you should be able to swipe tableViewCells and not drag in all 4 directions at once.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With