Add table view
self.tableView = [[UITableView alloc] init];
[self.view addSubview:self.tableView];
[self.tableView setTranslatesAutoresizingMaskIntoConstraints:NO];
Visual Style
id viewsDictionary = @{@"tblview": self.tableView};
[self.view addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|-5-[tblview]-5-|" options:0 metrics:nil views:viewsDictionary]];
[self.view addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|-20-[tblview]-60-|" options:0 metrics:nil views:viewsDictionary]];
Normal Style
[self.view addConstraint:[NSLayoutConstraint constraintWithItem:self.tableView attribute:NSLayoutAttributeLeading relatedBy:NSLayoutRelationEqual toItem:self.view attribute:NSLayoutAttributeLeading multiplier:1.0 constant:5.0]];
[self.view addConstraint:[NSLayoutConstraint constraintWithItem:self.tableView attribute:NSLayoutAttributeTrailing relatedBy:NSLayoutRelationEqual toItem:self.view attribute:NSLayoutAttributeTrailing multiplier:1.0 constant:5.0]];
[self.view addConstraint:[NSLayoutConstraint constraintWithItem:self.tableView attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.view attribute:NSLayoutAttributeTop multiplier:1.0 constant:20.0]];