I am using masonry to programmatically setup constraints on views. Several times I have wanted to offset a constraint by a characteristic of another view. Is that possible?
For example, I'd like to do this:
[self.someView mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.equalTo(self.mas_centerX).offset(self.otherView.mas_width);
}];
which of course doesn't compile because offset
expects a number and not a constraint.
Instead of
self.otherView.mas_width
in your offset, why not useself.otherView.frame.size.width
? Useheight
instead ofwidth
if you want the height of the view. This is the correct way to get the width or height of a view.