title: Issue with autoLayout and constraints
body: <p>I have an issue with iOS and AutoLayout...it is a testing application where I have replicated the problem. It consists in a simple view controller, containing a fixed <code>UIButton</code>; when user clicks this button, the delegate have to create a custom view, apply it positioning constraints; the view has then a method to build his content views, and the child views are placed with constraints too.</p>
  
  <p>Here is the code:</p>
  
  <pre><code>//MyViewController.m
  
  @implementation MyViewController
  
  - (void)viewDidLoad
  {
    [super viewDidLoad];
  // Do any additional setup after loading the view, typically from a nib.
  
    UIButton *start_but = [[UIButton alloc] initWithFrame:CGRectMake(10, 10, 100, 40)];
    [start_but setTitle:@"Draw" forState:UIControlStateNormal];
    [start_but setTitleColor:[UIColor yellowColor] forState:UIControlStateNormal];
    [start_but addTarget:self action:@selector(clickAction:) forControlEvents:UIControlEventTouchUpInside];
  
    [self.view addSubview:start_but];
  }
  
  - (void)didReceiveMemoryWarning
  {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
  }
  
  - (void)clickAction: (id)sender
  {
  
    localView = [[MyView alloc] initWithFrame:CGRectMake(0, 0, 400, 300)];
  
    UIView *superview = (UIView*)localView;
  
    superview.translatesAutoresizingMaskIntoConstraints = NO;
  
    [self.view addSubview:localView];
  
    NSLayoutConstraint *constr = [NSLayoutConstraint constraintWithItem:localView
                                                            attribute:NSLayoutAttributeTop
                                                            relatedBy:NSLayoutRelationEqual
                                                               toItem:self.view
                                                            attribute:NSLayoutAttributeTop
                                                           multiplier:1.0
                                                             constant:100.0];
  
    [self.view addConstraint:constr];
  
    constr = [NSLayoutConstraint constraintWithItem:localView
                                                            attribute:NSLayoutAttributeRight
                                                            relatedBy:NSLayoutRelationEqual
                                                               toItem:self.view
                                                            attribute:NSLayoutAttributeRight
                                                           multiplier:1.0
                                                             constant:-50.0];
    [self.view addConstraint:constr];
  
  
  
    [localView CreateGuiInterface];
  }
  
  @end
  
  
  //MyView.m
  
  
  @implementation MyView
  
  - (id)initWithFrame:(CGRect)frame
  {
    self = [super initWithFrame:frame];
    if (self)
    {
      // Initialization code
  
  
  
    }
    return self;
  }
  
  -(void)CreateGuiInterface
  {
    UIView *superview = self;
  
    self.backgroundColor = [UIColor redColor];
  
    UIButton *but1 = [[UIButton alloc] init];
    [but1 setTitle:@"Button" forState:UIControlStateNormal];
    [but1 setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
    but1.backgroundColor = [UIColor yellowColor];
  
    but1.translatesAutoresizingMaskIntoConstraints = NO;
  
    [superview addSubview:but1];
  
    NSLayoutConstraint *constraint = [NSLayoutConstraint constraintWithItem:but1
                                                                attribute:NSLayoutAttributeRight
                                                                relatedBy:NSLayoutRelationEqual
                                                                   toItem:superview
                                                                attribute:NSLayoutAttributeRight multiplier:1.0
                                                                 constant:-20.0];
  
    [superview addConstraint:constraint];
  
    constraint = [NSLayoutConstraint constraintWithItem:but1
                                            attribute:NSLayoutAttributeTop
                                            relatedBy:NSLayoutRelationEqual
                                               toItem:superview
                                            attribute:NSLayoutAttributeTop
                                           multiplier:1.0
                                             constant:50.0];
  
    [superview addConstraint:constraint];
  
    UILabel *label = [[UILabel alloc] init];
  
    label.text = @"Label";
    label.backgroundColor = [UIColor greenColor];
    label.textColor = [UIColor blackColor];
    label.translatesAutoresizingMaskIntoConstraints = NO;
  
    [superview addSubview:label];
  
    constraint = [NSLayoutConstraint constraintWithItem:label
                                            attribute:NSLayoutAttributeRight
                                            relatedBy:NSLayoutRelationEqual
                                               toItem:but1
                                            attribute:NSLayoutAttributeLeft
                                           multiplier:1.0
                                             constant:-40.0];
    [superview addConstraint:constraint];
  
    constraint = [NSLayoutConstraint constraintWithItem:label
                                            attribute:NSLayoutAttributeTop
                                            relatedBy:NSLayoutRelationEqual
                                               toItem:but1
                                            attribute:NSLayoutAttributeBottom
                                           multiplier:1.0
                                             constant:20.0];
  
    [superview addConstraint:constraint];
  
  } 
  
  @end
  </code></pre>
  
  <p>So, the problem is that when i click iOS seems to have problem to draw the view background color. It is strange, 'cause if i don't use <code>superview.translatesAutoresizingMaskIntoConstraints = NO</code> and put the view in a fixed place (with <code>initWithFrame:CGRect(100,200,300,400)</code> for example) without using constraints, it works fine: can there be problems using constraints in child and parent views? AppleDoc said that the constraints cannot pass throughout the view barrier; so i've written my app with local-view oriented constraints....
  can somebody help me? </p>
  
  <p>thanks in advice</p>