OfTheWolf / TwitterProfile

Nested scrolling with pager just like in Twitter and Instagram profile.
MIT License
266 stars 45 forks source link

Question, How to using load more bottom scroll #11

Closed maxkillpo closed 4 years ago

maxkillpo commented 4 years ago

I have a problem with doing additional loading pod PullToRefreshKit Can you recommend How to solve this problem And there is a problem with the bounce when I switch pages

OfTheWolf commented 4 years ago

Your question is not clear at all. Without code or detailed explanation of what you are experiencing I can not help you.

maxkillpo commented 4 years ago

I've added the refresh control below. It can't hold the footer. How can I solve this problem?

I use pod PullToRefreshKit.

Self.tableView.configRefreshFooter function

OfTheWolf commented 4 years ago

You are probably adding it to your tableView inside bottomVC. Instead you should add it to the scrollView which you can get from func tp_scrollViewDidLoad(_ scrollView: UIScrollView)

 func tp_scrollViewDidLoad(_ scrollView: UIScrollView) {
   // use this scrollView to add refreshFooter. 
    scrollView.configRefreshFooter(container:self) { [weak self] in }
}
maxkillpo commented 4 years ago

Not work

When additional items were added, it caused the position to malfunction. Regardless of whether I use the function inside or outside, there is still a problem with Offset

I added at tp_scrollViewDidLoad. Still have offset issues I added that there is still a problem with offset

Or should I use other methods? Can you recommend me

maxkillpo commented 4 years ago

I know the problem It will happen when adding items to the tableview. This will cause the offset to malfunction

OfTheWolf commented 4 years ago

@maxkillpo @iamarjun35

reloadPagerTabStripView() calls triggers viewControllers(for pagerTabStripController: PagerTabStripViewController) so it creates view controller instances again. moving vc instance creations outside will fix the problem.

Change the code inside viewControllers(..) to below:

.
.
.

let vc = UIStoryboard.init(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "BottomViewController") as! BottomViewController
        let vc1 = UIStoryboard.init(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "BottomViewController") as! BottomViewController
        let vc2 = UIStoryboard.init(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "BottomViewController") as! BottomViewController
        let vc3 = UIStoryboard.init(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "BottomViewController") as! BottomViewController

    // MARK: - PagerTabStripDataSource
    override func viewControllers(for pagerTabStripController: PagerTabStripViewController) -> [UIViewController] {
        vc.pageIndex = 0
        vc.pageTitle = "Tweets"
        vc.count = 10
        let child_1 = vc

        vc1.pageIndex = 1
        vc1.pageTitle = "Tweets & replies"
        vc1.count = 1
        let child_2 = vc1

        vc2.pageIndex = 2
        vc2.pageTitle = "Media"
        vc2.count = 10
        let child_3 = vc2

        vc3.pageIndex = 3
        vc3.pageTitle = "Likes"
        vc3.count = 2
        let child_4 = vc3

        return [child_1, child_2, child_3, child_4]
    }