UIPageViewController OR UIScrollView with paging Enabled = YES

I am a little confused about how I should implement below,

I need to scroll between UIViews or UIViewControllers , each of which has a different data set. For example, the 1st view has a UITableView, the other has only a button, the third can again have a UITableView.

Should I use UIPageViewController and load different UIViewControllers for each content or use UIScrollView with contentSize = number of pages .

In my current implementation. I used UIScrollView, which scrolls between different UIViews and loads their contents. But the problem is that when I click on a UITableView in one of the views, the transition events are not captured by the UITableView, but the UIScrollView captures touch events.

I tried to bring my UITableView to the fore,

 myTable.becomeFirstResponder()
 scrollView.bringSubviewToFront(myTable)

 scrollView.delaysContentTouches = false
 scrollView.canCancelContentTouches = false

I added a UITapGestureRecognizer to the UITableView, but it does not receive click events. UIScrollView gets a transition event if I add a UITapGestureRecognizer to it.

My current view hierarchy,

UIScrollView -->
              UIView --> 
                       UITableView
              UIView -->
                       UIButton and other subViews
              UIView --> 
                       UITableView

NOTE. I want this scroll view or swap view to be only part of my main view controller. (half of my main view)

Please help me with this.

+4
1

,

UIView , UITableView. , ,

UIScrollView -->

          UITableView --> 

          UIView -->
                   UIButton and other subViews
          UITableView --> 
0

Source: https://habr.com/ru/post/1615758/


All Articles