title: How to set UILabel only width and height and constraints programmatically
body: <p>I want to create a UILabel programmatically with height, width and then I want to add constraints to it also programmatically for positioning the UILabel.</p>
  
  <p><strong>Update:</strong> </p>
  
  <p>I want to create UI like this:</p>
  
  <p><img src="https://i.stack.imgur.com/kAemJ.png" alt="enter image description here"></p>
  
  <p><strong>How to create this UI All programatically</strong></p>
  
  <p>Code to create one label <code>label1</code> similarly I created two more label <code>label2</code> and <code>label3</code> </p>
  
  <pre><code>UILabel *label1 = [[UILabel alloc]init];
  
  label1.font = TitleFont;
  label1.numberOfLines=0;
  label1.text= @"Descriptions";
  label1.lineBreakMode=NSLineBreakByWordWrapping;
  [label1 sizeToFit];
  label1.backgroundColor=[UIColor blueColor];
  label1.textColor=[UIColor blackColor];
  label1.translatesAutoresizingMaskIntoConstraints = NO;
  [self.view addSubview:label1];
  </code></pre>
  
  <p>And now I am able to add horizontal constraints them with this code</p>
  
  <pre><code>[self.view addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|-[label1]-|" options:NSLayoutFormatDirectionLeadingToTrailing metrics:nil views:NSDictionaryOfVariableBindings(label1)]];
  </code></pre>
  
  <p>I am also able to set vertical constraint with view but I am unable to set constraint with from one label to another.</p>