nontomatic
nontomatic

Reputation: 2043

UITableView: How to attach a footer to a section with grouped dynamic prototype cells?

I'm trying to create a footer for a section with grouped dynamic prototype cells (Swift).

It works fine with static cells, there are even controls in Storyboard, but is this possible with a dynamically populated tableView, too?

I'm using both tableViews with static and dynamic cells in my app but I'd like to have them look similar.

Thanks a lot for your help.

Upvotes: 0

Views: 624

Answers (2)

nontomatic
nontomatic

Reputation: 2043

Turns out I simply had to implement this method into the viewController that holds this tableView:

override func tableView(tableView: UITableView, titleForFooterInSection section: Int) -> String? {
    return "This will appear in footer styling below the section."
}

Upvotes: 1

Kevin Lorena
Kevin Lorena

Reputation: 1

if your footer is cell in your tableview in storyboard you can do like this (just like a normal dynamic table view cell have fun ^^)

func tableView(tableView: UITableView, viewForFooterInSection section: Int) -> UIView? {
     // custom view for footer. will be adjusted to default or specified footer height

    let cell = tableView.dequeueReusableCellWithIdentifier("myfootercell") as? MyFooterTableViewCell;
    cell!.mLblMessage.text = "Hello";
    // Configure the cell...

    return cell!

}

Upvotes: 0

Related Questions