cool hit counter Using Masonry to prop up parent views with child views_Intefrankly

Using Masonry to prop up parent views with child views


Copyright: This is an original post by the blogger and may not be reproduced without the blogger's permission. https://blog.csdn.net/u010105969/article/details/80521257

A previous article (https://www.jianshu.com/p/9563f5b646d9 ) talked about using Masonry layout to make the height of the Cell to achieve adaptive, in fact, this is through the child view propped up the height of the parent view Cell. Today another simple code to see how the child view can hold up the parent view through Masonry's layout (allowing the parent view to be adaptive in size).

Code.

Reproducible code.

UIView* superView = [[UIViewalloc]init]; [self.viewaddSubview:superView]; UIView* subView = [[UIViewalloc]init]; [superViewaddSubview:subView]; superView.backgroundColor = [UIColor greenColor]; subView.backgroundColor = [UIColor yellowColor]; [superViewmas_makeConstraints:^(MASConstraintMaker *make) { make.left.equalTo(self.view.mas_left).offset(100); make.top.equalTo(self.view.mas_top).offset(100); }]; [subViewmas_makeConstraints:^(MASConstraintMaker *make) { make.left.equalTo(superView.mas_left).offset(10); make.top.equalTo(superView.mas_top).offset(10); make.right.equalTo(superView.mas_right).offset(-10); make.bottom.equalTo(superView.mas_bottom).offset(-10); make.width.height.equalTo(@(100)); }];

Renderings.

Applications in development.

Renderings.

For such a view where the height changes according to the text content we are well on our way.

Demo address.https://gitee.com/liangsenliangsen/Masonry_subAndSup.git

That concludes this post, may you all work less overtime for more pay, and have girlfriends for all gays and boyfriends for all women.


Recommended>>
1、VR technology is in desperate need of commercialization and content may be the key to winning
2、How to read with too little time
3、About Python crawlers heres an efficient learning path
4、web security shallow analysis
5、Spring Quick Start

    已推荐到看一看 和朋友分享想法
    最多200字,当前共 发送

    已发送

    朋友将在看一看看到

    确定
    分享你的想法...
    取消

    分享想法到看一看

    确定
    最多200字,当前共

    发送中

    网络异常,请稍后重试

    微信扫一扫
    关注该公众号