I\'m using autolayout on iOS7 and I have a problem like this:
I\'m putting a UILabel onto a UIView and I\'m arranging my autolayout constraints so that the label\'s cen
If you're using auto layout, you can set the horizontal constraints and use an NSDictionary
in the metrics
parameter to set this dynamically.
For instance, if you wanted to give a 10pt padding to the inner content of a UIButton
, you could do something like the following:
NSDictionary *padding = @{ @"padding" : @(button.intrinsicContentSize.width + 20) };
NSArray *buttonHConstraints = [NSLayoutConstraint constraintsWithVisualFormat:@"H:|[button(==padding)]|" options:0 metrics:padding views:NSDictionaryOfVariableBindings(button)];