title: How to change or update NSLayoutConstraint programmatically
body: <p>I have implemented AutoLayout programmatically using the Code :</p>
  
  <pre><code>- (void)addConstraintWithListNavigationViewController:(UIView *)listViewNavigation y:(CGFloat)y height:(CGFloat)height
  {
      //WIDTH_ListTableView = 0.4
  
      //set x = 0;
      NSLayoutConstraint *constraintToAnimate1 = [NSLayoutConstraint constraintWithItem:listViewNavigation
                                                                              attribute:NSLayoutAttributeLeft
                                                                              relatedBy:NSLayoutRelationEqual
                                                                                 toItem:self.view
                                                                              attribute:NSLayoutAttributeLeft
                                                                             multiplier:0.00
                                                                               constant:0];
      [self.view addConstraint:constraintToAnimate1];
  
  
      //set y = y;
      NSLayoutConstraint *constraintToAnimate2 = [NSLayoutConstraint constraintWithItem:listViewNavigation
                                                                              attribute:NSLayoutAttributeTop
                                                                              relatedBy:NSLayoutRelationEqual
                                                                                 toItem:self.view
                                                                              attribute:NSLayoutAttributeBottom
                                                                             multiplier:0.00
                                                                               constant:y];
      [self.view addConstraint:constraintToAnimate2];
  
  
  
  
  
  
  
  
      //set Width = self.view.frame.size.width*0.4
      NSLayoutConstraint *constraintToAnimate3 = [NSLayoutConstraint constraintWithItem:listViewNavigation
                                                                              attribute:NSLayoutAttributeWidth
                                                                              relatedBy:NSLayoutRelationEqual
                                                                                 toItem:self.view
                                                                              attribute:NSLayoutAttributeWidth
                                                                             multiplier:1-WIDTH_ListTableView
                                                                               constant:0.0];
      [self.view addConstraint:constraintToAnimate3];
  
  
  
  
  
      //Set height = height
      NSLayoutConstraint *constraintToAnimate4 = [NSLayoutConstraint constraintWithItem:listViewNavigation
                                                                              attribute:NSLayoutAttributeHeight
                                                                              relatedBy:NSLayoutRelationEqual
                                                                                 toItem:nil
                                                                              attribute:NSLayoutAttributeNotAnAttribute
                                                                             multiplier:0.00
                                                                               constant:height];
      [self.view addConstraint:constraintToAnimate4];
  }
  </code></pre>
  
  <p>And this works perfect, but every-time this ViewController receives a <strong>Notification</strong>, it will run:</p>
  
  <pre><code>[self.view layoutIfNeeded];
  </code></pre>
  
  <p>But I want to set the width of listViewNavigation according a boolean variable connected.</p>
  
  <pre><code>if(connected){
          listViewNavigation.view.frame.size.width = 0.4 * self.view.frame.size.width;
      }
      else{
          listViewNavigation.view.frame.size.width = 0.6 * self.view.frame.size.width;
      }
  </code></pre>
  
  <p>But i do not know how can I update the NSLayoutConstraint :</p>
  
  <pre><code>NSLayoutConstraint *constraintToAnimate3 = [NSLayoutConstraint constraintWithItem:PreView
                                                                              attribute:NSLayoutAttributeWidth
                                                                              relatedBy:NSLayoutRelationEqual
                                                                                 toItem:self.view
                                                                              attribute:NSLayoutAttributeWidth
                                                                             multiplier:1 - WIDTH_ListTableView
                                                                               constant:0.0];
  [self.view addConstraint:constraintToAnimate3];
  </code></pre>
  
  <p>when this ViewController receive the <strong>notification</strong>.</p>