Reputation: 763
I created custom UIViewController with xib and now I want to take first subview from it... it works on iOS 9, but on iOS 8 view.subviews has 0 views
let customVC = CustomViewController()
var customTestView = customVC.view.subviews.first
self.view should have 1 subview in it
Upvotes: 2
Views: 430
Reputation: 24714
If you create the ViewController with xib,you should use this to init the ViewController
let vc = CustomViewController(nibName: "nib", bundle: NSBundle.mainBundle())
Upvotes: 2