Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Direction to Scroll #33

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open

Direction to Scroll #33

wants to merge 7 commits into from

Conversation

bercik0291
Copy link

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

@@ -34,6 +34,7 @@ static void PBSwizzleMethod(Class c, SEL original, SEL alternate) {

// Keys for values in associated dictionary
static const void *kPBInfiniteScrollStateKey = &kPBInfiniteScrollStateKey;
static const void *kPBInfiniteScrollDirectionKey = &kPBInfiniteScrollDirectionKey;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any reason why it cannot reside within pb_infiniteScrollState?

@pronebird
Copy link
Owner

pronebird commented Apr 15, 2016

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!


/**
* Finish infinite scroll animations
*
* You must call this method from your infinite scroll handler to finish all
* animations properly and reset infinite scroll state
*/
- (void)finishInfiniteScroll;
- (void)finishInfiniteScroll:(BOOL)animated;
Copy link
Owner

@pronebird pronebird Apr 15, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be better to add DEPRECATED attribute and keep the method around for a while so others could adjust.

@bercik0291
Copy link
Author

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

@MHX792
Copy link

MHX792 commented Jun 19, 2016

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

@Flitskikker
Copy link

Any updates on this? @bercik0291 @pronebird

@Kacper20
Copy link

Kacper20 commented Feb 8, 2017

Hi there,

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

@Flitskikker
Copy link

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. 😄

@Kacper20
Copy link

Kacper20 commented Feb 8, 2017

@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?

@Flitskikker
Copy link

@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)!

@Kacper20
Copy link

Kacper20 commented Feb 8, 2017

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,

@pronebird
Copy link
Owner

pronebird commented Feb 10, 2017

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

@alizainprasla
Copy link

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

@sasojadrovski
Copy link

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!

@pronebird
Copy link
Owner

@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. :/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants