0

I've created a nib from which I load up my custom view with this code:

NSArray *topLevelObjects = [[NSBundle mainBundle] loadNibNamed:[[self class] description] owner:nil options:nil];
self = topLevelObjects[0];

But when I have autolayout enabled, I get this error:

Terminating app due to uncaught exception 'NSGenericException', reason: 'Unable to install constraint on view.  Does the constraint reference something from outside the subtree of the view?  That's illegal. constraint:<NSLayoutConstraint:0xb99a580 UIView:0xb997990.bottom == UIView:0xb995b20.bottom> view:<UIView: 0xb995b20; frame = (0 0; 320 320); autoresize = W+H; layer = <CALayer: 0xb995b80>>'

I want the view to be resizable. I don't want to use those undeletable autolayout size constraints. Setting their priority to 1 didn't work. In the superview I obviously don't have any constraint, I want this view to be universal.

How can I do this?

Miroslav Kuťák
  • 1,875
  • 1
  • 18
  • 24
  • "...undeletable autolayout size constraints" -- not sure what you mean by this. You can delete or modify constraints in code. What is "self" in your question? How does this view get on screen? – rdelmar Sep 17 '13 at 14:58
  • possible duplicate of [NSGenericException', reason: 'Unable to install constraint on view](http://stackoverflow.com/questions/14833070/nsgenericexception-reason-unable-to-install-constraint-on-view) – Max MacLeod Sep 17 '13 at 15:01
  • @rdelmar I mean those of topLevelObjects, eg. NIB where there's just one UIViewController, I mean those of it's view. – Miroslav Kuťák Sep 19 '13 at 10:00
  • @MaxMacLeod I also think that both threads are the same problem. Thank you. – Miroslav Kuťák Sep 19 '13 at 11:04

0 Answers0