Skip to content

Commit af72e52

Browse files
author
@欧柏泉
committed
紧急修复UILabel设置为wrapContentWidth时,在相对布局中同时设置了topPos和bottomPos时显示异常的BUG。
1 parent 6eb6963 commit af72e52

File tree

7 files changed

+20
-16
lines changed

7 files changed

+20
-16
lines changed

CHANGELOG.md

+6
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,12 @@
33

44
---
55

6+
## [V1.3.8](https://github.com/youngsoft/MyLinearLayout/releases/tag/1.3.8)(2017/6/2)
7+
8+
#### Fixed
9+
1. 修复了1.3.7中对UILabel设置为`wrapContentWidth`时又同时在相对布局中同时设置了`topPos``bottomPos`时高度不正确的问题。这个问题在1.3.7中的Fixed#3条目中没有修复正确。
10+
11+
612
## [V1.3.7](https://github.com/youngsoft/MyLinearLayout/releases/tag/1.3.7)(2017/6/1)
713

814
#### Added

MyLayout.podspec

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Pod::Spec.new do |s|
1616
#
1717

1818
s.name = "MyLayout"
19-
s.version = "1.3.7"
19+
s.version = "1.3.8"
2020
s.summary = "MyLayout is an iOS UI framework integrates the functions with Android,AutoLayout,SizeClass,HTML CSS float and flexbox,UIView UITableView."
2121

2222
s.description = <<-DESC
@@ -75,7 +75,7 @@ Pod::Spec.new do |s|
7575
# Supports git, hg, bzr, svn and HTTP.
7676
#
7777

78-
s.source = { :git => "https://github.com/youngsoft/MyLinearLayout.git", :tag => "1.3.7" }
78+
s.source = { :git => "https://github.com/youngsoft/MyLinearLayout.git", :tag => "1.3.8" }
7979

8080

8181
# ――― Source Code ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #

MyLayout/Lib/MyBaseLayout.m

-7
Original file line numberDiff line numberDiff line change
@@ -2244,13 +2244,6 @@ -(void)myCalcSizeOfWrapContentSubview:(UIView*)sbv sbvsc:(UIView*)sbvsc sbvmyFra
22442244
else
22452245
sbvmyFrame.height = [sbvsc.heightSizeInner measureWith:fitSize.height];
22462246
}
2247-
else
2248-
{
2249-
if (sbvsc.heightSizeInner.dimeVal == nil)
2250-
{
2251-
sbvmyFrame.height = fitSize.height;
2252-
}
2253-
}
22542247
}
22552248
}
22562249

MyLayout/Lib/MyLayout.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
*/
3838

3939

40-
//Current version is 1.3.7, please open: https://github.com/youngsoft/MyLinearLayout/blob/master/CHANGELOG.md to show the changes.
40+
//Current version is 1.3.8, please open: https://github.com/youngsoft/MyLinearLayout/blob/master/CHANGELOG.md to show the changes.
4141

4242

4343
#ifndef MyLayout_MyLayout_h

MyLayoutDemo/AllTest2TableViewCell.m

+9-4
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@ -(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSStri
3131
/**
3232
* 您可以尝试用不同的布局来实现相同的功能。
3333
*/
34-
// [self createLinearRootLayout];
35-
[self createRelativeRootLayout];
36-
// [self createFloatRootLayout];
34+
//[self createLinearRootLayout];
35+
// [self createRelativeRootLayout];
36+
[self createFloatRootLayout];
3737
}
3838

3939
return self;
@@ -116,6 +116,7 @@ -(void)createLinearRootLayout
116116
//这个设置的意思是_nameLabel的宽可以动态增长,但是不能超过父视图的宽度,并且要保证后面的2个图片视图显示出来。
117117
//您可以通过uBound方法设置尺寸的最大上边界。具体参见对uBound的方法的详细介绍。
118118
_nameLabel.widthSize.equalTo(_nameLabel.widthSize).uBound(userNameLayout.widthSize, -(5 + 14 + 5 + 14), 1);
119+
_nameLabel.heightSize.equalTo(@25);
119120
[userNameLayout addSubview:_nameLabel];
120121

121122
UIImageView *editImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"edit"]];
@@ -143,6 +144,7 @@ -(void)createLinearRootLayout
143144
_priceLabel.adjustsFontSizeToFitWidth = YES;
144145
//宽度最宽为100,注意到这里使用了宏MYDIMESCALEW表示会根据屏幕的宽度来对100进行缩放。这个100是按iPhone6为标准设置的。具体请参考MyDimeScale类。
145146
_priceLabel.widthSize.equalTo(_priceLabel.widthSize).uBound(@(MYDIMESCALEW(100)), 0, 1).lBound(@(MYDIMESCALEW(50)), 0, 1);
147+
_priceLabel.heightSize.equalTo(@25);
146148
_priceLabel.myLeading = 10;
147149
[rootLayout addSubview:_priceLabel];
148150

@@ -180,13 +182,15 @@ -(void)createRelativeRootLayout
180182
_priceLabel.centerYPos.equalTo(rootLayout.centerYPos);
181183
//priceLabel的宽度根据内容自适应,但是最大的宽度是100,最小的宽度是50。注意到这里使用了宏MYDIMESCALEW表示会根据屏幕的宽度来对100进行缩放。这个100是在DEMO中是按iPhone6为标准设置的。具体请参考MyDimeScale类的介绍。
182184
_priceLabel.widthSize.equalTo(_priceLabel.widthSize).uBound(@(MYDIMESCALEW(100)), 0, 1).lBound(@(MYDIMESCALEW(50)), 0, 1);
185+
_priceLabel.heightSize.equalTo(@25);
183186
[rootLayout addSubview:_priceLabel];
184187

185188

186189
_nameLabel = [UILabel new];
187190
_nameLabel.font = [CFTool font:17];
188191
_nameLabel.textColor = [CFTool color:3];
189-
_nameLabel.wrapContentWidth = YES; //视图的宽度由内容包裹
192+
_nameLabel.widthSize.equalTo(_nameLabel.widthSize); //视图的宽度由内容包裹
193+
_nameLabel.heightSize.equalTo(@25);
190194
_nameLabel.leadingPos.equalTo(_headImageView.trailingPos);
191195
//1.3.0版本最新支持。设置_nameLabel的右边距最大是_priceLabel的左边距,再偏移两个小图标和间距的距离。这样当_nameLabel的尺寸超过这个最大的右边距时就会自动的缩小视图的宽度。
192196
_nameLabel.trailingPos.uBound(_priceLabel.leadingPos, (5 + 14 + 5 + 14));
@@ -269,6 +273,7 @@ -(void)createFloatRootLayout
269273
//这个设置的意思是_nameLabel的宽可以动态增长,但是不能超过父视图的宽度,并且要保证后面的2个图片视图显示出来。
270274
//您可以通过uBound方法设置尺寸的最大上边界。具体参见对uBound的方法的详细介绍。
271275
_nameLabel.widthSize.equalTo(_nameLabel.widthSize).uBound(userInfoLayout.widthSize, -(5 + 14 + 5 + 14), 1);
276+
_nameLabel.heightSize.equalTo(@25);
272277
[userInfoLayout addSubview:_nameLabel];
273278

274279
UIImageView *editImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"edit"]];

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -558,7 +558,7 @@ To integrate MyLayout into your Xcode project using CocoaPods, specify it in you
558558
source 'https://github.com/CocoaPods/Specs.git'
559559
platform :ios, '7.0'
560560

561-
pod 'MyLayout', '~> 1.3.7'
561+
pod 'MyLayout', '~> 1.3.8'
562562
```
563563
564564
Then, run the following command:

README.zh.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -566,7 +566,7 @@ $ gem install cocoapods
566566
source 'https://github.com/CocoaPods/Specs.git'
567567
platform :ios, '7.0'
568568
569-
pod 'MyLayout', '~> 1.3.7'
569+
pod 'MyLayout', '~> 1.3.8'
570570
```
571571

572572
然后运行如下命令:

0 commit comments

Comments
 (0)