SnapKit/Masonry

Add Hugging and CompressionResistance Please

Open

#344 opened on May 18, 2016

View on GitHub
 (9 comments) (16 reactions) (0 assignees)Objective-C (18,166 stars) (3,153 forks)batch import
enhancementhelp wanted

Description

I want to add hugging constraint to a view now, but it is not elegant code to write so

[self.footTitleSignBackgroundView mas_makeConstraints:^(MASConstraintMaker *make) {
    make.left.equalTo(self.footView);
    make.centerY.equalTo(self.footView.mas_centerY).offset(0);
}];
[self.footTitleSignBackgroundView setContentHuggingPriority:UILayoutPriorityRequired forAxis:UILayoutConstraintAxisHorizontal];
[self.footTitleSignBackgroundView setContentCompressionResistancePriority:UILayoutPriorityRequired forAxis:UILayoutConstraintAxisHorizontal];

I think you should add this syntax into Masonry

make.horizontal.huggingRequired()
make.horizontal.huggingHigh()
make.horizontal.huggingFittingSizeLevel()
make.horizontal.huggingLow()
make.vertical...
make.horizontal.compressionResistance...
make.vertical.compressionResistance...

Contributor guide

Add Hugging and CompressionResistance Please · SnapKit/Masonry#344 | Good First Issue