numberOfSectionsInTableView, numberOfRowsInSection, titleForHeaderInSection cellForRowAtIndexPath
let section = ["section1", "section2"]
let cellsInSection = [["section1cell1", "section1cell2"], ["section2cell1", "section2cell2"]]
override func numberOfSectionsInTableView(tableView: UITableView) -> Int {
return section.count
}
override func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return cellsInSection[section].count
}
override func tableView(tableView: UITableView, titleForHeaderInSection section: Int) -> String? {
return section[section]
}
override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
if indexPath.section == 0 {
let cell = tableView.dequeueReusableCellWithIdentifier("section1", forIndexPath: indexPath) as! SectionOneTableViewCell
return cell
} else if indexPath.section == 1 {
let cell = tableView.dequeueReusableCellWithIdentifier("section2", forIndexPath: indexPath) as! SectionTwoTableViewCell
return cell
}
}