Skip to content
This repository has been archived by the owner on Nov 5, 2020. It is now read-only.

Simple example expands less items than returned by delegate #12

Closed
alexandre-g opened this issue Aug 3, 2017 · 2 comments
Closed

Simple example expands less items than returned by delegate #12

alexandre-g opened this issue Aug 3, 2017 · 2 comments
Assignees
Milestone

Comments

@alexandre-g
Copy link

func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
		return 4
}

But sections expand to 3 rows :/

@okhanokbay okhanokbay added this to the 0.4.0 milestone Aug 3, 2017
@okhanokbay
Copy link
Owner

Sections are being expanded and collapsed when you use ExpyTableView.

The cell instance that you return from expandableCellForSection: data source method is actually the first row of belonged section. Thus, when you return 4 from numberOfRowsInSection data source method, first row refers to expandable cell and the other 3 rows refer to other rows in this section.

So, it is the desired result and it is not the number of rows that will expand, it is the number of the rows in section including expandable cell.

In a future version, this situation will be more clear by little changes.

@okhanokbay okhanokbay self-assigned this Aug 3, 2017
@alexandre-g
Copy link
Author

Hi, thanks for the prompt reply. Thought it was a bug as was first confused trying to implement with one of the sections being non expandable - and the delegate not asking for it as I didn't have the canExpand method, so had the first row missing. Then tried with the Basic example and had that. More clear now and after reading the code comments, but perhaps would be good to add some of these intricacies into the readme at some point before it's more clear implementation wise.

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

No branches or pull requests

2 participants