UITableView의 섹션에서 머리글 제목을 얻으려는 경우, 구문에서 구문은 무엇입니까? swift 섹션에서 머리글 제목을 얻으려고합니다.UITableView get titleForHeadersInSection 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;
}
이유 : 당신의 코드를 사용하여 : (섹션있는 tableView, titleForHeaderInSection) 예를 들어
,
self.tableView을 제목 대신 비교하기 위해 섹션 번호를 사용하지 않습니까? – zisoft
실제로 Header In Section의 제목을 가져 오는 구문을 알고 싶습니다. –