Your layout is very likely ambiguous. You've only told the system to pin the view at the top and the right. It can satisfy those constraints by being a 1x1pt tiny box in the top right corner, but also by filling the entire superview. Therefore, the Auto Layout system also needs to know how to calculate the width and height of the subview before the view is sufficiently constrained.
[containerView addConstraint:[NSLayoutConstraint constraintWithItem:settingsView attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:nil attribute: 0 multiplier:1.0 constant:140.0]]; [containerView addConstraint:[NSLayoutConstraint constraintWithItem:settingsView attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:0 multiplier:1.0 constant:140.0]];
Make sure you set the
translatesAutoresizingMaskIntoConstraints
property of the subview toNO
.
Try that and perhaps it will also fix your buttons.