I'm trying to create a reference to my TableView's static section. I control-drag the section from the Document Outline ("My Section", highlighted in the second screenshot) into the associated code file and Xcode offers to connect to a new UITableViewSection outlet (the "Type" field was pre-filled with "UITableViewSection"):
But then Xcode immediately complains telling me it doesn't know what UITableViewSection is:
I've imported UIKit, so that's not it. I can't find any documentation for UITableViewSection. It seems to not exist, but then why would Xcode let me drag it into the file to create an outlet?
You can not declare UITableViewSection like that, as there as no class available with that name. You can do it simply by creating a custom prototype UITableViewCell and can use it custom section header like below-
override func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
let cell = self.tableView.dequeueReusableCell(withIdentifier: "SectionHeader") as! CustomHeaderUITableViewCell
return cell
}
override func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
return 60
}
I tried the same thing and same error occured. What i did was instead of creating an outlet on the section, i created an outlet on the Content View
@IBOutlet var editCountdownTableViewCell: UITableViewCell!
I am creating it because i want to be able to hide and show.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With