i am new to iOS, so i am confronted with this problem: I wrote an UICollectionView in an UIViewController (parent) with an UICollectionResuableView as a header.
class ParentViewController: UIViewController, SideBarDelegate {
@IBOutlet weak var mPreviewsCollection: UICollectionView!
override func viewDidLoad() {
...
}
...
}
This UICollectionResuableView contain another UICollectionView (child) to provide dynamic customized tabs (maybe not the best idea, but it looks as was intended).
class ChildHeaderCollectionReusableView: UICollectionReusableView {
@IBOutlet var mTabHeader: UICollectionView!
required init(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
}
func collectionView(collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
...
}
...
Now i want to to change the content of the parent UICollectionView (reloadData()) when selecting a cell in the child. How can i do that? How can i execute methods in the running instance of the parent from outside?
e.g. var rootViewController = self.window!.rootViewController as KioskViewController
returns another instance of my parent UIViewController with zero content