Я программно создаю представление и использую автомакет, вообще не создаю интерфейс. В пользовательском контроллере ScrollView я добавляю UILabel и UIButton в качестве подвидов. Я хочу выровнять метку по левому краю экрана, а кнопку по правому краю экрана. По какой-то причине моя кнопка выравнивается только слева от моего прокрутки. Я урезал свой код, так что это только эти две метки, и я не могу понять, почему он не будет выравниваться по правому краю.
HWScrollViewController.m (как я инициализирую основной вид прокрутки)
- (void)loadView
{
self.scrollView = [[UIScrollView alloc] initWithFrame:[[UIScreen mainScreen] applicationFrame]];
self.scrollView.delegate = self;
self.view = self.scrollView;
}
HWListingDetailViewController.m
- (void)viewDidLoad
{
[super viewDidLoad];
UILabel *priceLabel = [[UILabel alloc] init];
UIButton *favouriteButton = [UIButton buttonWithType:UIButtonTypeContactAdd];
[priceLabel setTranslatesAutoresizingMaskIntoConstraints:NO];
[favouriteButton setTranslatesAutoresizingMaskIntoConstraints:NO];
[priceLabel setText:@"$125.00"];
[favouriteButton setTitle:@"Add to Favourites" forState:UIControlStateNormal];
[self.view addSubview:priceLabel];
[self.view addSubview:favouriteButton];
[self.view addConstraints:@[
[NSLayoutConstraint constraintWithItem:priceLabel
attribute:NSLayoutAttributeCenterY
relatedBy:NSLayoutRelationEqual
toItem:self.view
attribute:NSLayoutAttributeCenterY
multiplier:1
constant:0],
[NSLayoutConstraint constraintWithItem:priceLabel
attribute:NSLayoutAttributeLeft
relatedBy:NSLayoutRelationEqual
toItem:self.view
attribute:NSLayoutAttributeLeft
multiplier:1
constant:5],
[NSLayoutConstraint constraintWithItem:favouriteButton
attribute:NSLayoutAttributeCenterY
relatedBy:NSLayoutRelationEqual
toItem:self.view
attribute:NSLayoutAttributeCenterY
multiplier:1
constant:0],
[NSLayoutConstraint constraintWithItem:favouriteButton
attribute:NSLayoutAttributeRight
relatedBy:NSLayoutRelationEqual
toItem:self.view
attribute:NSLayoutAttributeRight
multiplier:1
constant:5],
}

Как видите, зеленая ценовая метка выровнена правильно, а красная кнопка далеко от левой части экрана. (Я дал ему 5 пикселей смещения, чтобы показать, где он был.) Итак, почему правая сторона прокрутки на самом деле левая сторона? Как я могу правильно выровнять по правому краю экрана? Где я ошибся? Это сводит меня с ума!
Спасибо за любую помощь!
Окончательные изображения макета: я надеюсь, что окончательный макет будет примерно таким: 
и я ожидаю, что это будет выглядеть так, если повернуть в альбомную ориентацию: 