J A S K I E R
J A S K I E R

Reputation: 2184

How to change properties of items in TableView through the ContainerView in Swift?


As a solution from StackOverflow to avoid this error:

  1. Created a container view inside the view.
  2. Deleted the connection and simple view on the right.
  3. Created TableView on the right and Embedded with Container View.

Problem: I have some values to display from the previous view, but I can't access these textFields on the right. (different class now).

Question: How to read/write data to/from the textFields with Container View?

enter image description here

Upvotes: 0

Views: 102

Answers (1)

Naga Syam
Naga Syam

Reputation: 126

Try to get the child view controllers of parent view controller (View controller that have container view in it) from there. From the child view controllers array cast your view controller (Which have your tableview in it) and make an instance.

Using this instance you can change the properties of tableview.

if let vcChild : ChildViewController = self.childViewControllers[0] as! ChildViewController { vcInfo.tableView.reloadData() }

Upvotes: 2

Related Questions