2016-12-07 4 views
1

Я не могу найти текст в разделе заголовка. Это, как я устанавливаю раздел Заголовок:viewForHeaderInSection раздел не отображает заголовок

override func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int { 
    return myDataSource[section].otherKeyValues.count 
} 

override func numberOfSectionsInTableView(tableView: UITableView) -> Int { 
    return myDataSource.count 
} 

override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell { 
    let cell: AccordionDetailTableViewCell = (NSBundle.mainBundle().loadNibNamed("AccordionDetailTableViewCell", owner: self, options: nil).first as? AccordionDetailTableViewCell)! 
    //  cell.headerLabel!.text = "This is a test" 
    let currentCellData = myDataSource[indexPath.section] 
    cell.headerLabel!.text = currentCellData.otherKeyValues[indexPath.row].key 
    cell.detailLabel!.text = currentCellData.otherKeyValues[indexPath.row].value 
    return cell 

} 

override func tableView(tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? { 

    let view: AccordionHeaderView = (NSBundle.mainBundle().loadNibNamed("AccordionHeaderView", owner: self, options: nil).first as? AccordionHeaderView)! 
    view.tag = section 
      view.delegate = self 
    view.titleLabel!.text = myDataSource[section].dateCreated == nil || myDataSource[section].dateCreated == "" ? " " : myDataSource[section].dateCreated 
    return view 
} 

элементы отображаются в ячейках, и даже если я устанавливаю view.titleLabel!.text = "Hello" тогда Здравствуйте не появляется.

Я использую UIViewController и реализован FZAccordionTableView

Что я здесь делаю неправильно?

+1

Пожалуйста реализовать метод heightForHeaderInSection вашего Tableview – Aakash

+0

я реализовал свой взгляд, чтобы UITableViewAutomaticDimension теперь ничто не появляется даже клетка также не видело – Sam

+0

Дайте им статическую высоту для того и посмотреть, видны ли они или нет. – Aakash

ответ

1

Вы должны реализовать метод UITableview Делегирования как heightForHeaderInSection

func tableView(tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat { 

     return 30 

} 
Смежные вопросы