Reputation: 13
I have the following problem: There is a view with the class UniObjectsTableViewController in the storyboard and AreasTableViewController inherits from this class. Then I load the class AreasTableViewController from code in the following way:
let areaViewController = AreasTableViewController()
self.navigationController?.pushViewController(areaViewController, animated: true)
UniObjectsTableViewController has an outlet to a SDStateTableView.
@IBOutlet var stateTableView: SDStateTableView!
If I try to print the outlet in the viewDidLoad() method of the AreasTableViewController it's nil.
print(stateTableView) => nil
Is there any way to acces the outlets of a motherclass in the inherited class?
Upvotes: 0
Views: 64
Reputation: 797
Step 1: Give your child class instance a name on stoayboard
Step 2: Open the base class under Manual in the Assistant editor, then you can command+drag
Step 3:
let storyboard = UIStoryboard(name: "Main", bundle: nil)
let areaViewController = storyboard.instantiateViewController(withIdentifier: "ChildViewController")
self.navigationController?.pushViewController(areaViewController, animated: true)
Upvotes: 0