title: Is it right to add subview in layoutSubviews when using Autolayout
body: <p>I wrote codes like these that works well</p>
  
  <pre><code>@interface SubView()
  @property(nonatomic,strong) UIButton* btn;
  @end
  
  @implementation SubView
  
  
  - (void)layoutSubviews
  {
      [super layoutSubviews];
      [self.btn removeFromSuperview];
      self.btn = [UIButton buttonWithType:UIButtonTypeCustom];
      self.btn.backgroundColor = [UIColor greenColor];
      [self.btn setTitle:@"btn" forState:UIControlStateNormal];
      self.btn.translatesAutoresizingMaskIntoConstraints = NO;
      [self addSubview:self.btn];
  
      NSLayoutConstraint* centerXConstraint = [self.btn.centerXAnchor constraintEqualToAnchor:self.centerXAnchor];
      NSLayoutConstraint* centerYConstraint = [self.btn.centerYAnchor constraintEqualToAnchor:self.centerYAnchor];
      [self addConstraint:centerXConstraint];
      [self addConstraint:centerYConstraint];
  }
  @end
  </code></pre>
  
  <p>But in my opinion,When using Autolayout, the system  will do the layout in two steps <strong>1 Update Pass 2 Layout Pass</strong> , and the layoutSubviews is in the step 2(Layout Pass)</p>
  
  <p>so if we add subview in layoutSubviews ,it seems like it will change the view's constraints , so we need do the update pass  and layout pass again , so it will generate a infinite loop ..</p>
  
  <p>but in fact , this code works well , so where am i wrong?</p>