justinmfischer / SwiftyAccordionCells

Example Swift 3.0 Xcode 8.0 project which demonstrates how to expand and collapse a UITableView like an accordion. Using this lightweight data structure approach, UITableViewCell header/sub-item rows can be added or removed dynamically as needed. Subclass table for further reuse.
MIT License
169 stars 34 forks source link

How to align x for subitems? Also why I need to double header to expand, can't it be expand with single click? #13

Open Neeraj204 opened 7 years ago

Neeraj204 commented 7 years ago

This is great library and fulfill my requirement but, I need subitems to be aligned like tree (see attached screenshot). And for exapnding cell why I have to double click on header items everytime? how can I expand it with single click?

2s6tm

kamalupasena commented 7 years ago

remove self.tableView.allowsMultipleSelection = true this line so you dont have to double click on header item again.and for align this as a tree you just have to use two different cells for header item and items this is how i achieve that

if item as? SwiftyAccordionCells.HeaderItem != nil {

            let cell =  tableView.dequeueReusableCell(withIdentifier: kTableCellName, for: indexPath) as! SideMenuTableViewCell
            ...

            return cell
        }else{

            let cell = tableView.dequeueReusableCell(withIdentifier: kTableChildCellName, for: indexPath) as! SideMenuChildItemTableViewCell
            ...
            return cell

        }
Neeraj204 commented 7 years ago

@kamalupasena That's not working, same result as before.