2016-06-10 3 views
1

Iam пытается добавить табличное представление для просмотра контроллера. Все в порядке, но нижний колонтитул скрыт/отключен? Я не знаю.Tableview footer not show

Мой код:

private let footerView = UIView() 
footerView.backgroundColor = UIColor.Green.color 
footerView.addSubview(activityIndicator) 
tableView.addSubview(footerView) 

tableView.delegate = self 
tableView.dataSource = self 
tableView.tableFooterView = footerView 
tableView.sectionFooterHeight = 20 
tableView.footerViewForSection(0) 
tableView.tableHeaderView = footerView 

наверняка:

func tableView(tableView: UITableView, titleForFooterInSection section: Int) -> String? { 
    return "test.." 
} 

func tableView(tableView: UITableView, viewForFooterInSection section: Int) -> UIView? { 
    return footerView 
} 

func tableView(tableView: UITableView, heightForFooterInSection section: Int) -> CGFloat { 
    return 20 
} 

Я попытался как осуществление отдельно и ничего (белое пространство только).

И мой взгляд сноска светло-серый и реализован индикатор активности является «невидимым» (рама устанавливается)

Его ViewController с Tableview.

Любая идея, почему нет нижнего колонтитула, видимого справа?

спасибо.

ответ

4

Вы забыли установить рамку вашего footerView


Удалить все первую часть кода и использовать это:

func tableView(tableView: UITableView, viewForFooterInSection section: Int) -> UIView? { 
    return UIView(frame: CGRectMake(0, 0, tableView.bounds.size.width, 20)) 
} 

func tableView(tableView: UITableView, heightForFooterInSection section: Int) -> CGFloat { 
    return 20 
} 
1
func tableView(tableView: UITableView, viewForFooterInSection section: Int) -> UIView? { 

    let footerView = UIView(frame: CGRectMake(0, 0, tableView.frame.size.width, 40)) 
    footerView.addSubview(activityIndicator) 
    return footerView 
} 
+0

Хотя этот код может быть Вопрос был бы полезен для объяснения. – BDL

-1
addfooterView() 

func addfooterView() { 

footerView = UIView(frame: CGRectMake(0, 0, UIScreen 
.mainScreen().bounds.width, 150)) 
    footerView.backgroundColor = UIColor.whiteColor() 
    tableViewLFStation.tableFooterView = footerView } 

// вызывать этот метод при Вы хотите добавить нижний колонтитул в свою таблицу