标签:
LR来找我健身,她说同学都领证了,她着急,东来顺,宝鼎羊肉,大碗茄子
YY秀聚餐自拍,太美啦
换产品,展书房不带这个项目,换人,改需求,页面大改动
准备做家庭医生,页面很多,加油,拼,眼睛痛就洗手间休息,闭眼,洗脸,
晚上回去必须刷牙,现在没怎么泡脚了,也没怎么coding了,
Q:Scroll 在ios7不能滚动 ios9可以滚动
A: 添加约束:
[contentScrollView mas_makeConstraints:^(MASConstraintMaker *make) {
make.bottom.equalTo(self.contentLabel.mas_bottom); // greaterThanOrEqualTo 添加的约束,解决ios7不能滚动的bug
make.height.mas_equalTo(contentLabelHeight - 2);
}];
-----------------------------------------------------------------
小蓝点不能跟label对齐,原因是lable被拉伸了,怎么发现的呢,给label添加红色颜色,发现只有一行文案的时候,lable很高
解决办法是算出字符串的高度,给label添加高度约束
原因: 图片是有大小的,label高度不能撑开图片的话,图片就按照自身的高度展示,label就被拉大了,当label足够多的时候,图片可以被撑开,
--------
------------------------------------------------------------------------------------
先调用initWithModel然后掉用 viewDidLoad
------------------------------------------------------------------------------------------------
原因是先设置了容器view的高度
[self.topWhiteView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(self.bgScrollView);
make.left.right.equalTo(self.view);
make.height.mas_equalTo(200); //高度自适应 test
}];
后面又添加了底部约束
[self.topWhiteView mas_makeConstraints:^(MASConstraintMaker *make) {
make.bottom.mas_equalTo(self.labelButtonView).offset(kHDFVerticalMargin);
}];
,其实约束冲突了,控制台答应了约束错误信息:
Try this:
(1) look at each constraint and try to figure out which you don‘t expect;
(2) find the code that added the unwanted constraint or constraints and fix it.
(
"<MASLayoutConstraint:0x7b7a16e0 UIView:0x79eda150.height == 200>",
"<MASLayoutConstraint:0x7b788250 UILabel:0x79eda370.top == UIView:0x79eda150.top + 20>",
"<MASLayoutConstraint:0x79ec8b50 UILabel:0x79eda370.height == 16.707>",
"<MASLayoutConstraint:0x7b7d1850 UILabel:0x7b7af810.top == UILabel:0x79eda370.bottom + 8>",
"<MASLayoutConstraint:0x7b74dbb0 UILabel:0x7b7af810.height == 16.707>",
"<MASLayoutConstraint:0x7b7c5560 UILabel:0x7b7d31e0.top == UILabel:0x7b7af810.bottom + 10>",
"<MASLayoutConstraint:0x7b7d10e0 UILabel:0x7b75ea10.height == 16.707>",
如何debug的,添加很多停诊时间数据,发现并没有撑开View,猜测是view的高度被写死了,真是
-------
scrollView不能滚动
不用设置contentSize, 纯约束就行 自定义的底部view也要设置约束:
[self mas_makeConstraints:^(MASConstraintMaker *make) {
make.bottom.equalTo(commentView);
}];
[self.bgScrollView mas_makeConstraints:^(MASConstraintMaker *make) {
make.bottom.mas_equalTo(self.bottomToTravelView); // scrollview的约束
}];
scrollView初始约束:
[_bgScrollView mas_makeConstraints:^(MASConstraintMaker *make) {
make.edges.equalTo(self.view);
}];
----------
对象为nil不能加约束
标签:
原文地址:http://www.cnblogs.com/tufei7/p/5518776.html