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

Add support for custom frame #37

Closed
wants to merge 1 commit into from

Conversation

XiaonuoGantan
Copy link

Add a method -(id)initWithFrame:InScrollView: in ODRefreshControl to
allow users of the class to provide a custom frame. Currently,
ODRefreshControl is assuming that the parent UITableView has vertical
UITableViewCells, which may not be the case in apps like Pulse-news,
where the UITableViewCells are layed out horizontally on the
UITableView. Add the aforementioned method to allow assigning custom
frame for the control so that it can animate properly in a horizontal
UITableView.

Add a method -(id)initWithFrame:InScrollView: in ODRefreshControl to
allow users of the class to provide a custom frame. Currently,
ODRefreshControl is assuming that the parent UITableView has vertical
UITableViewCells, which may not be the case in apps like Pulse-news,
where the UITableViewCells are layed out horizontally on the
UITableView. Add the aforementioned method to allow assigning custom
frame for the control so that it can animate properly in a horizontal
UITableView.
@Sephiroth87
Copy link
Owner

Mhm, first of all, there's something very wrong, you should not use self before init...

Secondly, I don't see the point of this.
I checked pulse, but it's a simple tableView and the control will work perfectly.
Can you send me an example project where this is needed?

@XiaonuoGantan
Copy link
Author

It's incorrect to use self before init. The method - (id)initInScrollView:activityIndicatorView: should be refactored into another method which calls another internal initializer to return self. That internal initializer should also be called by - (id)initWithFrame:InScrollView: to provide a custom frame.

An example project where this is needed is https://github.com/XiaonuoGantan/Felipe-Laso-HorizontalTableView-Demo-With-ODRefreshControl. Notice the file HorizontalTableCell_iPhone.m includes two ways to initialize a ODRefreshControl and the control cannot display properly when a custom frame is not provided.

@Sephiroth87
Copy link
Owner

I now understand what you're trying to do, but it's such a special case that I don't like have to handle it here...
(Also, that surely is an awkward way to implement an horizontal table, IMHO)...

Anyway, there's a much more simple solution to the problem: simply instantiate the refreshControl BEFORE applying the transform to the table view, and it'll work automagically ;)

@XiaonuoGantan
Copy link
Author

You're absolutely correct! How come I never thought about this simple solution?!

Thank you for correcting my horrible code :)

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

Successfully merging this pull request may close these issues.

None yet

2 participants