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

Best practice to expand a cell animated in a section? #711

Closed
PhilCai1993 opened this issue May 2, 2017 · 6 comments
Closed

Best practice to expand a cell animated in a section? #711

PhilCai1993 opened this issue May 2, 2017 · 6 comments
Labels

Comments

@PhilCai1993
Copy link
Contributor

PhilCai1993 commented May 2, 2017

I've read #499 and #459 , But still quite confused.

image

The image above is a section controller, "cell2" is expanded when some extra data is received from HTTP request. The single section is composed of a red header and serval cells(I didn't make each cell a section because the whole list is rather complicated, there are a lot of other kind of sections).

The section controller has a "model", naming "SectionObject" for example.

@interface SectionObject : NSObject <IGListDiffable>
@property (nonatomic, copy) NSArray *datas;//(each data represent a cell, there are 4 in the pic above)
@end

If I want to expand the "cell2", I found the index of data which represent "cell2", modify that data, then call reloadInSectionController:atIndexes: in IGListBatchContext. The cell did expand with a default animation. But if I want to take advantage of the invalid layout API to make spring animations, I didn't find a good practice.

And in the example of #499 , the height of the cell is bind to a property height in section controller, the "data" is not modified. And in my example, the data for the cell is modified(add some extra info from server then update the cell).

@rnystrom
Copy link
Contributor

rnystrom commented May 4, 2017

@PhilCai1993 what determines the height of cell2? Is it the data itself? A member/property of the data?

Can you not just call invalidateLayoutForSectionController: self like in the example?

@PhilCai1993
Copy link
Contributor Author

one property of the data

@rnystrom
Copy link
Contributor

rnystrom commented May 5, 2017

@PhilCai1993 As long as the data makes its way to the section controller, the invalidate API should work exactly the same as reloadInSectionController:. Just call invalidate after the data has changed.

@PhilCai1993
Copy link
Contributor Author

PhilCai1993 commented May 10, 2017

@rnystrom I'll post some examples later at the weekend.

@jessesquires
Copy link
Contributor

Going to close as resolved. 😄

@PhilCai1993
Copy link
Contributor Author

@jessesquires 😄 OK, I did post any example because I'm busy with my work😂. Could I reopen it when examples are post?

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

No branches or pull requests

3 participants