Salome Tsiramua
Salome Tsiramua

Reputation: 763

self.view.subviews empty in iOS 8

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

1

self.view should have 1 subview in it

Upvotes: 2

Views: 430

Answers (1)

Leo
Leo

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

Related Questions