Let's say I have an instance variable from a superclass named label, and I want to set auto layout constraints using the visual format. If I try to use self.label in the format string, I get parse errors, and I don't have access to _label from a subclass. The workaround that is currently working is below, but it seems kind of ugly. Is there a better way?
UILabel *label = self.label;
NSDictionary *views = NSDictionaryOfVariableBindings(label, _textField);
[self.contentView addConstraints:
[NSLayoutConstraint constraintsWithVisualFormat:@"H:|-[label(==_textField)][_textField(==label)]-|"
options:NSLayoutFormatAlignAllCenterY
metrics:nil
views:views]];