In my scenario, I have a static tableview
. Now I need to add dynamic tableview
at the bottom of static tableview
. As per my scenario, I can’t able to mix both in one tableview. So, I have to add dynamic tableview bottom of static tableview
footer or any other bottom accessory view. I tried below methods
- Added
footer
view in staticcell
tableview and within that footer I have added dynamic tableview but the dynamic tableview not expanding the footer height based on its cell count also, it is not allowing dynamic cell selection. - Added
accessory
view but don’t know how to add it at bottom of the tableview
My StaticTableview Cell Code
override func numberOfSections(in tableView: UITableView) -> Int {
return 4
}
override func tableView(_ tableView: UITableView, titleForHeaderInSection section: Int) -> String? {
return " "
}
func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
if (section == 0) {
return 2
} else if(section == 1) {
return 1
} else if(section == 2) {
return 3
} else {
return 1
}
}
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "cell", for: indexPath as IndexPath) as UITableViewCell
return cell
}
override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
tableView.deselectRow(at: indexPath, animated: true)
if indexPath.section == 0 && indexPath.row == 0 { }
else if indexPath.section == 0 && indexPath.row == 1 {
} else if indexPath.section == 1 && indexPath.row == 0 {
} else if indexPath.section == 2 && indexPath.row == 0 {
} else if indexPath.section == 2 && indexPath.row == 1 {
} else if indexPath.section == 2 && indexPath.row == 2 {
} else if indexPath.section == 2 && indexPath.row == 3 {
} else {
}
}