Tôi muốn nhận Tiêu đề của Tiêu đề trong phần của UITableView, Vui lòng hướng dẫn tôi cú pháp trong số swift để nhận Tiêu đề của Tiêu đề trong phần là gì.UITableView có được tiêu đềĐối vớiHeadersInSection swift
func tableView(tableView : UITableView, titleForHeaderInSection section: Int)->String
{
switch(section)
{
case 2:return "Title 2"
break
default :return ""
break
}
}
func tableView (tableView:UITableView , heightForHeaderInSection section:Int)->Float
{
var title = tableView.titleForHeaderInSection[section];
if (title == "") {
return 0.0;
}
return 20.0;
}
func tableView (tableView:UITableView, viewForHeaderInSection section:Int)->UIView
{
var title = tableView.titleForHeaderInSection[section] as String
if (title == "") {
return UIView(frame:CGRectZero);
}
var headerView:UIView! = UIView (frame:CGRectMake(0, 0, self.tableView.frame.size.width, 20.0));
headerView.backgroundColor = self.view.backgroundColor;
return headerView;
}
Tại sao bạn không sử dụng số phần để so sánh thay vì tiêu đề? – zisoft
thực sự tôi muốn biết cú pháp để có được tiêu đề Đối với tiêu đề trong phần. –