UITableview var benim UITableview
sayfama eklemeye çalışıyorum.iOS Swift viewForHeaderInSection Çağırılmadı
Ancak, viewForHeaderInSection çağrılmıyor, ancak titleForHeaderInSection çağrıldığını veya gösterildiğini görüyorum. Bunun için özel bir hücre üstbilgisi kullanmayı denedim ve ayrıca çalışmaz.
Neyi yanlış yaptığımı bilmiyorum.
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"
}
Evet. Haklısın. tableView.delegate = kendi kendine çalışır. Teşekkür ederim. Bunu unutmuşum. – user3110353
Yardımın buna sevindim. Bu cevabı kabul etmeyi unutma. Teşekkür ederiz – croX
Eğer tabloyu storyboard'dan kullanırsanız, o zaman delege yöntemini storyboard'un kendisinden ayarlayabilirsiniz. – iDevAmit