UITableView obtenir titleForHeadersInSection swift

Je veux mettre le titre de l'en-tête dans la section de UITableView. Quelle est la syntaxe dans swift pour définir le titre de l'en-tête de la section.

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;
}
Pourquoi n'utilisez-vous pas le numéro de l'article pour comparer à la place du titre?
en fait, je veut savoir la syntaxe pour obtenir le titre d'en-Tête De Section.

OriginalL'auteur Anupam Mishra | 2014-11-19