UIScrollView-InfiniteScroll icon indicating copy to clipboard operation
UIScrollView-InfiniteScroll copied to clipboard

Direction to Scroll

Open bercik0291 opened this issue 9 years ago • 13 comments

add ability to choose direction of infinity scroll (top or bottom).

bercik0291 avatar Apr 06 '16 11:04 bercik0291

Hi @bercik0291,

I just pulled your fork and it works very well! Apart from couple of minor issues, great work! I'll see if I can find some time over weekend to refine your PR.

Thank you!

pronebird avatar Apr 15 '16 10:04 pronebird

@pronebird Ok, thanks for review, I will fix everything during this weekend

bercik0291 avatar Apr 15 '16 10:04 bercik0291

The PR unfortunately does not work with JSQMessagesViewController. The reload spinner doesn't appear.

MHX792 avatar Jun 19 '16 12:06 MHX792

Any updates on this? @bercik0291 @pronebird

Flitskikker avatar Aug 11 '16 13:08 Flitskikker

Hi there,

Any update on this? @bercik0291 @pronebird Would be really cool to have a possibility to do so in this library.

Kacper20 avatar Feb 08 '17 11:02 Kacper20

I'll post my workaround as mentioned in #30 here as well:

I'm currently using the following workaround for this.

For my table view:

class UIReversedTableView: UITableView {
    required init?(coder aDecoder: NSCoder) {
        super.init(coder: aDecoder)

        self.transform = CGAffineTransformMakeScale(1, -1)
    }
}

For my table view cells:

class UIReversedTableViewCell: UITableViewCell {
    required init?(coder aDecoder: NSCoder) {
        super.init(coder: aDecoder)

        self.transform = CGAffineTransformMakeScale(1, -1)
    }
}

In my view controller (viewDidLoad):

// Invert infinite scrolling indicator
let indicator = UIActivityIndicatorView(activityIndicatorStyle: .Gray)
indicator.transform = CGAffineTransformMakeScale(1, -1)
self.tableView.infiniteScrollIndicatorView = indicator

// Hide repeated lines
self.tableView.tableFooterView = UIView()

Looks hacky, but works surprisingly well thus far for me. No need to inverse your data either. 😄

Flitskikker avatar Feb 08 '17 11:02 Flitskikker

@Flitskikker How does it work without inverting your data? I think that messages supposed to be in reversed order after these operations. Or am I wrong?

Kacper20 avatar Feb 08 '17 11:02 Kacper20

@Kacper20 It works by first mirroring the whole UITableView vertically, and then mirroring the individual cells vertically. That way, the order is reversed without altering the data source. Also the scroll direction is reversed, including the infinite scrolling.

image

The activity indicator is also mirrored, so I create a new already mirrored activity indicator, so that the resulting activity loader will look normal (actually it's mirrored twice).

Why mirror vertically instead of rotating 180 degrees? Then the swipe actions still work normally (from the right hand side)!

Flitskikker avatar Feb 08 '17 12:02 Flitskikker

Thanks for explanation @Flitskikker. I was meaning, that to maintain old positioning(oldest message "A" first on the list) you'd have to reverse your data source too.(now you have C, B, A).

Cheers,

Kacper20 avatar Feb 08 '17 13:02 Kacper20

@Flitskikker @Kacper20 haven't had time to revisit this. This PR has to be refined and merged with existing master.

pronebird avatar Feb 10 '17 10:02 pronebird

How to use it? is it merged in current commit?

alizainprasla avatar Aug 22 '17 09:08 alizainprasla

Hey @pronebird @bercik0291,

Could you please take a look at this and merge it when ready. Or any update on when to expect it?

Thanks in advance!

sasojadrovski avatar Aug 30 '17 18:08 sasojadrovski

@sasojadrovski there are issues with this PR and I left comments long ago but I don't think there's been any progress on this since then. :/

pronebird avatar Mar 18 '18 12:03 pronebird