The only way I've gotten this to work is by putting labels (with no titles, so they're invisible) between the edges and between the buttons, so that the buttons and labels take up all the vertical space on the screen. The buttons have an intrinsic size, but the labels don't, so they expand or contract to fill the space correctly.
-(void)viewDidLoad {
[super viewDidLoad];
NSMutableDictionary *viewsDict = [NSMutableDictionary dictionary];
NSArray *titles = @[@"Button 1",@"Button 2",@"Button 3",@"Button 4",@"Button 5"];
for (int i=1; i<6; i++) {
UIButton *b = [UIButton buttonWithType:1];
[b setTitle:titles[i-1] forState:UIControlStateNormal];
[b setTranslatesAutoresizingMaskIntoConstraints:NO];
[viewsDict setObject:b forKey:[NSString stringWithFormat:@"b%d",i]];
}
for (int i=1; i<7; i++) { // labels for spacing
UILabel *l = [[UILabel alloc ]init];
[l setTranslatesAutoresizingMaskIntoConstraints:NO];
[viewsDict setObject:l forKey:[NSString stringWithFormat:@"l%d",i]];
}
for (id obj in viewsDict.allKeys)
[self.view addSubview:viewsDict[obj]];
NSArray *constraints = [NSLayoutConstraint constraintsWithVisualFormat:@"V:|[l1][b1][l2(==l1)][b2][l3(==l1)][b3][l4(==l1)][b4][l5(==l1)][b5][l6(==l1)]|"
options:NSLayoutFormatAlignAllLeading
metrics:nil
views:viewsDict];
NSArray *constraints2 = [NSLayoutConstraint constraintsWithVisualFormat:@"|-100-[b1]"
options:NSLayoutFormatAlignAllLeading
metrics:nil
views:viewsDict];
[self.view addConstraints:constraints];
[self.view addConstraints:constraints2];
}
This aligns all the buttons 100 points from the left edge, with equal spacing between the buttons. This will adjust for screen size as well as rotation.