Advertisement
Guest User

Untitled

a guest
Dec 20th, 2014
184
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.17 KB | None | 0 0
  1. self.mainViewController = [[MainViewController alloc] initWithNibName:@"MainViewController" bundle:nil];
  2. [self.view addSubview:self.mainViewController.view];
  3. [self.view sendSubviewToBack:self.mainViewController.view];
  4. [self addChildViewController:self.mainViewController];
  5. [self.mainViewController didMoveToParentViewController:self];
  6.  
  7. NSDictionary *views = @{@"view" : self.mainViewController.view};
  8. NSArray *vertical = [NSLayoutConstraint constraintsWithVisualFormat:@"V:|-0-[view]-0-|" options:0 metrics:nil views:views];
  9. NSArray *horizontal = [NSLayoutConstraint constraintsWithVisualFormat:@"H:|-0-[view]-0-|" options:0 metrics:nil views:views];
  10. [self.mainViewController.view addConstraints:vertical];
  11. [self.mainViewController.view addConstraints:horizontal];
  12.  
  13. The view hierarchy is not prepared for the constraint: <NSLayoutConstraint:0x7f9c9bd330b0 V:|-(0)-[UIView:0x7f9c9bc3bc30] (Names: '|':UIView:0x7f9c9bf83fa0 )>
  14. When added to a view, the constraint's items must be descendants of that view (or the view itself). This will crash if the constraint needs to be resolved before the view hierarchy is assembled. Break on -[UIView _viewHierarchyUnpreparedForConstraint:] to debug.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement