Abdelrahman
Abdelrahman

Reputation: 1027

View is loaded from nib but is not visible?

I create two custom views using nib files and I create one instance for each class and then I added the two views to my main view , the first view is added and the second is loaded but not visible.

I load the views from the nib file using the following class method

class func instanceFromNib() -> CustomView {
    let view = NSBundle.mainBundle().loadNibNamed("CustomView", owner: self, options: nil).first as! CustomView
    return view
}

I need help to figure out what is going wrong with the second view.

Upvotes: 2

Views: 1257

Answers (1)

Basheer_CAD
Basheer_CAD

Reputation: 4919

try this:

view.translatesAutoresizingMaskIntoConstraints = true
 view.autoresizingMask = .None

Upvotes: 4

Related Questions