title: Adding centreX and centreY Constraint programmatically using obj c
body: <p>Hi i have a assignment to add constraint programmatically to my logIn page. I have a view controller inside the view controller i added my uitextfield , uilabel , uibutton ..etc.
  I want to make my view control to the centre of my main page both in X and Y direction.I am not getting it the correct output.</p>
  
  <pre><code>[_logInView setTranslatesAutoresizingMaskIntoConstraints:NO];
  [self.view addConstraint:[NSLayoutConstraint constraintWithItem:self.view attribute:NSLayoutAttributeCenterX relatedBy:NSLayoutRelationEqual toItem:self.logInView attribute:NSLayoutAttributeCenterX multiplier:1.0 constant:0.0]];
  [self.view addConstraint:[NSLayoutConstraint constraintWithItem:self.view attribute:NSLayoutAttributeCenterY relatedBy:NSLayoutRelationEqual toItem:self.logInView attribute:NSLayoutAttributeCenterY multiplier:1.0 constant:0.0]];
  [self.view addConstraint:[NSLayoutConstraint constraintWithItem:self.logInView attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1 constant:309]];
  [self.view addConstraint:[NSLayoutConstraint constraintWithItem:self.logInView attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1 constant:309]];
  </code></pre>
  
  <p><a href="https://drive.google.com/file/d/0B9YZfopxzOv5ME95VTNvN010eWM/view?usp=sharing" rel="nofollow">https://drive.google.com/file/d/0B9YZfopxzOv5ME95VTNvN010eWM/view?usp=sharing</a>
  <a href="https://drive.google.com/file/d/0B9YZfopxzOv5dWxWV2Zrd2NwSUU/view?usp=sharing" rel="nofollow">https://drive.google.com/file/d/0B9YZfopxzOv5dWxWV2Zrd2NwSUU/view?usp=sharing</a></p>