Iglistkit: Best practice to expand a cell animated in a section?

Created on 2 May 2017  路  6Comments  路  Source: Instagram/IGListKit

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

question

Most helpful comment

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

All 6 comments

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

one property of the data

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

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

Going to close as resolved. 馃槃

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

Was this page helpful?
0 / 5 - 0 ratings