ViewForHeaderInsection не призван для моего представления о таблицеIOS

Программируем под IOS
Anonymous
ViewForHeaderInsection не призван для моего представления о таблице

Сообщение Anonymous »

У меня есть uitableview, я пытаюсь добавить Headerview в свой uitableview .
Однако viewforheaderinsection не вызывается. Но я вижу, что TitleForHeaderInsection вызывается или отображается. Я также пытался использовать пользовательский заголовок сотовой связи для этого, и он также не работает. < /P>
Я понятия не имею, что делаю не так.

Код: Выделить всё

override func viewDidLoad() {
super.viewDidLoad()

self.title = "Groceries"

tableView.registerNib(UINib(nibName: "TransactionSpecifiedCategoriesTableViewCell", bundle: nil), forCellReuseIdentifier: "TransactionSpecifiedCategoriesTableViewCell")
tableView.registerNib(UINib(nibName: "TransactionSpecifiedCategoriesHeaderViewCell", bundle: nil), forHeaderFooterViewReuseIdentifier: "TransactionSpecifiedCategoriesHeaderViewCell")
tableView.tableFooterView = UIView(frame: CGRectMake(0, 0, 0, 0))
}

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

let footerView = UIView(frame: CGRectMake(0, 0, tableView.frame.size.width, 100))

footerView.backgroundColor = UIColor.blackColor()

return footerView

//let header: UITableViewHeaderFooterView = view as UITableViewHeaderFooterView
//var headerView = UIView(frame: CGRectMake(0, 0, 100, 320))
//headerView.backgroundColor = UIColor.blackColor()
//
//return headerView
}

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

func tableView(tableView: UITableView, titleForHeaderInSection section: Int) -> String? {
return "First section header title"
}


Подробнее здесь: https://stackoverflow.com/questions/291 ... table-view

Вернуться в «IOS»