I've defined a base class which has an UITableView outlet.
class BaseController: UIViewController, UITableViewDataSource, UITableViewDelegate {
@IBOutlet weak var tableView: UITableView!
...
Then I've inherited the class as follows:
class SubViewController: BaseController {
override func viewDidLoad() {
tableView.rowHeight = screenHeigth / CGFloat(textArray.count)
But the tableView is nil, I've just recently started programming in swift, is it possible to inherit an outlet? If so, how should I do it?
I'm currently using Xcode 6.4
You can inherit an outlet. In your storyboard (assumption), the view controller class name should be set to the name of your subclass. You can then connect up the table view to the outlet in the storyboard.
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