Reputation: 2013
I have a UITableView with expand and collapse cells when I tap in the sections. Now I want to collapse the cells again when I tap in one of this cells and give the name of this cell to the section up there. I think that collapse is not a problem but I do not know how to change the name. I have done everything programmatically. Thank you
Upvotes: 0
Views: 77
Reputation: 1320
You can try like this:
add an observer in custom section view to update title. Because section view is reused in UITableView,need a parameter(such as: int sectionIndex) to definite witch section the section view belong to.
in tableView:viewForHeaderInSection: set sectionView.sectionIndex with indexPath.section
in tableView:didSelectRowAtIndexPath: post a notification with indexPath.section and title string
Upvotes: 1