How to enable UITableView swipe to delete along with horizontal page swiping - ios

In one of my app, I am having multiple table views inside a horizontal scroll view. So, user can horizontally swipe between table views. I am not using UIPageViewController for some reason.
The problem that I am facing is that I have swipe to delete feature on my UITableView but does not work when I have multiple pages in the horizontal scroll view.
Is there an elegant way to provide both the features at the same time?

You can subclass UIScrollView and implement UIGestureRecognizerDelegate. Then return true in gestureRecognizer(_:,shouldRecognizeSimultaneouslyWith) for the appropriate recognizers.

Related

How disable/enable scrolling in UITableView during one gesture (iOS - Swift)

I need create similar detail view as in Maps app in iOS. This view is possible to pull out from bottom and contains UITableView. The problem is with enabling/disabling scrolling of table view. I know that table view has attribute isScrollingEnabled, but if I change it, it works only for new gesture. Is there any way, how could I enable or disable scrolling during one gesture?

Swift; is scrollView with tableView feasible?

I've have been trying for a while now, to implement a specific behavior in my app. On the initial view of my app, there must be a logo(imageView), a label and a textField. It should be possible to scroll down from the initial view, to a tableView. while the user scrolls down, the label in moved up in the window, to form a search field for the tableView. Then the scrollView should lock to the part with the tableView, and it should only be possible to scroll back up, if dragging elsewhere than the tableView.
What is best practice for doing as described?
The image show (only for illustration, i havn't been using story board when trying to implement it) an overview of the problem:
The way I've tried to do this so far, is by embedding the tableView in a scrollView (as seen on image), enabling paging on the scrollView, and than disabling scrolling on the scrollView, when the buttom part has been reached. I've added a gesture reconizer on the part with of the screen with the textField.
These two posts (Scrollview with embedded tableview and Use Pan Recognizer to Control ScrollView) descripe i further detail what i've tried so far.
But the question is more to, is there an alternate solution for making behaviour descriped above?
Maybe interactive animated transitioning between view controllers somehow?
YES there are! Implement a table view with a header view. And remove the scroll view.
self.tableView.tableHeaderView = topView
where topView will be the view wish as the UIImage, the label and textField

multiple view controllers with tableview inside scrollview

I have 3 viewcontrollers inside a UIScrollView that page horizontally. each viewcontroller has a tableview within it.
I can swipe between the 3 viewcontrollers easily when the active table is still (not scrolling) - but when i try to page left or right when the tableview is moving it seems to ignore the touch and gets stuck. I have to stop the tableview with a touch before paging (almost as if the tableview is trying to receive the horizontal gesture)
how can I make my scrollview always react to a horizontal paging
here is a visual of my setup:
tell me if you need any more info
There are multiple ways to get around this.
One way is that you could manage the horizontal scrolling yourself with UIGestureRecognizer. So if there is a left swipe then scroll horizontally to the left and vice versa for right swipe. That way if a UITableViewController is vertically scrolling at the time of the horizontal swipe, it won't have to wait until it is stopped to detect it.

How to enable UIPageViewController's page scroll while scrolling its content vertically (a collection view)?

I'm making an app like SmartNews, with a UIPageViewController that contains many UICollectionView pages.
The structure:
A UIPageViewController, with pages scrolling horizontally. (Transition style is UIPageViewControllerTransitionStyleScroll)
Each page in it contains a UICollectionView scrolling a set of cells vertically.
Both view have the same size and touch areas on the screen are common.
The problem:
While the collection view is scrolling down by itself (i.e. the user is no longer touching the screen but the collection view is still scrolling by decelerating), the user can't swipe pages.
It seems if another pan gesture occurs at this moment, it is tracked by the collection view to stop the current scroll and it doesn't allow the user to swipe the page view controller.
Is there a way to allow the user to scroll pages (horizontally), while the collection view is still scrolling (vertically)?
(Instagram's search view realizes this feature.)
Thanks!
Found what I wanted to do here:
Cross Directional UIScrollViews - Can I Modify the Scrolling Behaviour?
I guess it's unsafe to do the same with UIPageController as the scroll view inside it is undocumented.
I will try to replace the UIPageController with a UISCrollView with paging enabled.

UIScrollView - scroll or swipe?

In my app I have a UIScrollView and I need to swipe left and right from one picture to the next, but I also need to recognize a scroll.
How do I differentiate between a scroll and a swipe with UIScrollView?
I believe you're actually looking for is an implementation of UIScrollView with Paging, as you do not need to handle the touch events yourself, or determine if they are scrolls or swipes.
The Apple Documentation on Scroll Views and Paging Mode should help you get started
Look into the UIScrollView Delegate Methods. ScrollView can detect different types of actions drag etc or add swipeGesture directly to the scroll view
StackOverflow has questions already on this
iOS: UIScrollView detecting Swipe Gesture
Setting up UIScrollView to swipe between 3 view controllers
How to recognize swipe gesture in UIScrollView

Resources