Skip to content

Commit f1539ba

Browse files
author
@欧柏泉
committed
Release V1.3.3
1 parent 13f7207 commit f1539ba

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+853
-439
lines changed

CHANGELOG.md

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

44
---
55

6+
7+
## [V1.3.3](https://github.com/youngsoft/MyLinearLayout/releases/tag/1.3.3)(2017/2/24)
8+
9+
#### Added
10+
1. 线性布局`MyLinearLayout`中的`shrinkType`中添加了一个可设置的值`MySubviewsShrink_Auto` 这个值的目的是为了解决水平线性布局里面当有左右2个子视图的宽度都不确定,但又不希望2个子视图不能重叠展示的问题。具体例子参见(DEMO:AllTest7ViewController 中的第4个例子)。
11+
2. 布局视图添加了属性`zeroPadding`用来描述当布局视图的尺寸由子视图决定,并且当布局视图中没有任何子视图时设置的padding值是否会参与布局视图尺寸的计算。默认是YES,当设置为NO时则当布局视图没有子视图时padding是不会参与布局视图尺寸的计算的。具体例子参见 (DEMO: LLTest4ViewController)
12+
3. 添加了线性布局、流式布局、浮动布局的initWithFrame的方法,这样你就可以用这个方法来指定frame值了。
13+
4. 添加了对普通视图的`wrapContentHeight``wrapContentWidth`的支持,这两个属性由原来的布局视图属性移植到了所有视图的扩展属性中。这样对于一个非布局父视图也可以通过设置`wrapContentHeight``wrapContentWidth`来实现其高度和宽度由里面的子布局视图来决定。具体例子参见(DEMO: LLTest4ViewController)。
14+
5. 添加了对UIButton的宽度固定情况下高度自自适应的支持。
15+
16+
#### Changed
17+
1. 删除框架布局的子视图要通过`marginGravity`的扩展属性来设置位置和尺寸的支持,具体变化参见MyFrameLayout.h中的代替方法。
18+
2. 取消了对自适应高度视图扩展属性`flexedHeight`的支持,将高度自适应设置改为了通过`wrapContentHeight`扩展属性的设置来完成。
19+
3. 优化了通过`makeLayout`来进行布局约束设置的一些方法。
20+
4. 修正了将一个布局视图添加到非布局视图里面后,如果后续调整了布局视图的边界设置后无法更新布局视图尺寸的问题。
21+
22+
623
## [V1.3.2](https://github.com/youngsoft/MyLinearLayout/releases/tag/1.3.2)(2017/1/20)
724

825
#### 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.2"
19+
s.version = "1.3.3"
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.2" }
78+
s.source = { :git => "https://github.com/youngsoft/MyLinearLayout.git", :tag => "1.3.3" }
7979

8080

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

MyLayout.xcodeproj/project.pbxproj

+6
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
186B83E01D094F11001CA155 /* FLLTest2ViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 186B83E21D094F11001CA155 /* FLLTest2ViewController.xib */; };
2525
186B83E41D095A49001CA155 /* FOLTest1ViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 186B83E61D095A49001CA155 /* FOLTest1ViewController.xib */; };
2626
186C530C1C75A5BB0031B2A2 /* MyFloatLayout.m in Sources */ = {isa = PBXBuildFile; fileRef = 186C530B1C75A5BB0031B2A2 /* MyFloatLayout.m */; };
27+
187075FF1E5A9B44004FA21B /* FLLTest6ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 187075FE1E5A9B44004FA21B /* FLLTest6ViewController.m */; };
2728
1871D25F1D2F5ABA00D37F55 /* MyPathLayout.m in Sources */ = {isa = PBXBuildFile; fileRef = 1871D25E1D2F5ABA00D37F55 /* MyPathLayout.m */; };
2829
188261CF1C647CB300996C2C /* AllTest6ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 188261CE1C647CB300996C2C /* AllTest6ViewController.m */; };
2930
188D90E01DE736BB0034F76E /* MyLayoutClass.png in Resources */ = {isa = PBXBuildFile; fileRef = 188D90DF1DE736BB0034F76E /* MyLayoutClass.png */; };
@@ -142,6 +143,8 @@
142143
186DF3701D523EDB00039E44 /* fl.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = fl.png; sourceTree = "<group>"; };
143144
186DF3711D523EDB00039E44 /* fll.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = fll.png; sourceTree = "<group>"; };
144145
186DF3721D523EDB00039E44 /* flo.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = flo.png; sourceTree = "<group>"; };
146+
187075FD1E5A9B44004FA21B /* FLLTest6ViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FLLTest6ViewController.h; sourceTree = "<group>"; };
147+
187075FE1E5A9B44004FA21B /* FLLTest6ViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FLLTest6ViewController.m; sourceTree = "<group>"; };
145148
1871D25D1D2F5ABA00D37F55 /* MyPathLayout.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MyPathLayout.h; sourceTree = "<group>"; };
146149
1871D25E1D2F5ABA00D37F55 /* MyPathLayout.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MyPathLayout.m; sourceTree = "<group>"; };
147150
188261CD1C647CB300996C2C /* AllTest6ViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AllTest6ViewController.h; sourceTree = "<group>"; };
@@ -455,6 +458,8 @@
455458
18BCC5191D2D4885005081FF /* FLLTest4ViewController.m */,
456459
181550661E2F75DF00329BFF /* FLLTest5ViewController.h */,
457460
181550671E2F75EA00329BFF /* FLLTest5ViewController.m */,
461+
187075FD1E5A9B44004FA21B /* FLLTest6ViewController.h */,
462+
187075FE1E5A9B44004FA21B /* FLLTest6ViewController.m */,
458463
);
459464
name = FlowLayoutDemo;
460465
sourceTree = "<group>";
@@ -782,6 +787,7 @@
782787
181550681E2F75EA00329BFF /* FLLTest5ViewController.m in Sources */,
783788
18296B751C76D67F00273C3E /* FOLTest3ViewController.m in Sources */,
784789
18D684461C4F421400A48BB4 /* LLTest2ViewController.m in Sources */,
790+
187075FF1E5A9B44004FA21B /* FLLTest6ViewController.m in Sources */,
785791
18D684411C4F421400A48BB4 /* MyLinearLayout.m in Sources */,
786792
18D6844A1C4F421400A48BB4 /* LLTest6ViewController.m in Sources */,
787793
18D684341C4F421400A48BB4 /* AppDelegate.m in Sources */,

MyLayout/AllTest1TableViewCell.m

+3-6
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,7 @@ -(void)createLinearRootLayout
123123
_textMessageLabel.textColor = [CFTool color:4];
124124
_textMessageLabel.myLeftMargin = 0;
125125
_textMessageLabel.myRightMargin = 0; //垂直线性布局里面如果同时设置了左右边距则能确定子视图的宽度,这里表示宽度和父视图相等。
126-
_textMessageLabel.numberOfLines = 0;
127-
_textMessageLabel.flexedHeight = YES; //如果想让文本的高度是动态的,请在设置明确宽度的情况下将numberOfLines设置为0并且将flexedHeight设置为YES。
126+
_textMessageLabel.wrapContentHeight = YES; //如果想让文本的高度是动态的,请在设置明确宽度的情况下将wrapContentHeight设置为YES。
128127
[messageLayout addSubview:_textMessageLabel];
129128

130129

@@ -171,8 +170,7 @@ -(void)createRelativeRootLayout
171170
_textMessageLabel.leftPos.equalTo(_headImageView.rightPos).offset(5); //文本消息的左边在头像视图的右边并偏移5个点。
172171
_textMessageLabel.rightPos.equalTo(_rootLayout.rightPos); //文本消息的右边和父布局的右边对齐。上面2行代码也同时确定了文本消息的宽度。
173172
_textMessageLabel.topPos.equalTo(_nickNameLabel.bottomPos).offset(5); //文本消息的顶部在昵称文本的底部并偏移5个点。
174-
_textMessageLabel.numberOfLines = 0;
175-
_textMessageLabel.flexedHeight = YES; //如果想让文本消息的高度是动态的,请在设置明确宽度的情况下将numberOfLines设置为0并且将flexedHeight设置为YES。
173+
_textMessageLabel.wrapContentHeight = YES; //如果想让文本消息的高度是动态的,请在设置明确宽度的情况下将wrapContentHeight设置为YES。
176174
[_rootLayout addSubview:_textMessageLabel];
177175

178176

@@ -220,8 +218,7 @@ -(void)createFloatRootLayout
220218
_textMessageLabel.font = [CFTool font:15];
221219
_textMessageLabel.textColor = [CFTool color:4];
222220
_textMessageLabel.weight = 1; //占用剩余宽度
223-
_textMessageLabel.numberOfLines = 0;
224-
_textMessageLabel.flexedHeight = YES; //如果想让文本消息的高度是动态的,请在设置明确宽度的情况下将numberOfLines设置为0并且将flexedHeight设置为YES。
221+
_textMessageLabel.wrapContentHeight = YES; //如果想让文本消息的高度是动态的,请在设置明确宽度的情况下将wrapContentHeight设置为YES。
225222
[_rootLayout addSubview:_textMessageLabel];
226223

227224
_imageMessageImageView = [UIImageView new];

MyLayout/AllTest1TableViewHeaderFooterView.m

+22-10
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ -(instancetype)initWithReuseIdentifier:(NSString *)reuseIdentifier
3030

3131
MyFrameLayout *leftItemLayout = [self createItemLayout:NSLocalizedString(@"Show", @"") withTag:0];
3232
leftItemLayout.widthDime.equalTo(rootLayout.widthDime).multiply(1/3.0);
33-
leftItemLayout.marginGravity = MyMarginGravity_Vert_Fill | MyMarginGravity_Horz_Left;
33+
leftItemLayout.heightDime.equalTo(rootLayout.heightDime);
3434
leftItemLayout.highlightedOpacity = 0.5;
3535
[rootLayout addSubview:leftItemLayout];
3636

@@ -39,25 +39,30 @@ -(instancetype)initWithReuseIdentifier:(NSString *)reuseIdentifier
3939

4040
MyFrameLayout *centerItemLayout = [self createItemLayout:NSLocalizedString(@"Topic", @"") withTag:1];
4141
centerItemLayout.widthDime.equalTo(rootLayout.widthDime).multiply(1/3.0);
42-
centerItemLayout.marginGravity = MyMarginGravity_Vert_Fill | MyMarginGravity_Horz_Center;
42+
centerItemLayout.heightDime.equalTo(rootLayout.heightDime);
43+
centerItemLayout.centerXPos.equalTo(@0);
4344
centerItemLayout.leftBorderLine = bld;
4445
centerItemLayout.highlightedOpacity = 0.5;
4546
[rootLayout addSubview:centerItemLayout];
4647

4748

4849
MyFrameLayout *rightItemLayout = [self createItemLayout:NSLocalizedString(@"Follow", @"") withTag:2];
4950
rightItemLayout.widthDime.equalTo(rootLayout.widthDime).multiply(1/3.0);
50-
rightItemLayout.marginGravity = MyMarginGravity_Vert_Fill | MyMarginGravity_Horz_Right;
51+
rightItemLayout.heightDime.equalTo(rootLayout.heightDime);
52+
rightItemLayout.rightPos.equalTo(@0);
5153
rightItemLayout.leftBorderLine = bld;
5254
rightItemLayout.highlightedOpacity = 0.5;
5355
[rootLayout addSubview:rightItemLayout];
5456

5557
//底部的横线
5658
_underLineView = [UIView new];
57-
_underLineView.myHeight = 2;
5859
_underLineView.backgroundColor = [UIColor redColor];
5960
_underLineView.widthDime.equalTo(rootLayout.widthDime).multiply(1/3.0);
60-
_underLineView.marginGravity = MyMarginGravity_Vert_Bottom | MyMarginGravity_Horz_Left;
61+
_underLineView.heightDime.equalTo(@2);
62+
_underLineView.bottomPos.equalTo(@0);
63+
_underLineView.leftPos.equalTo(@0).active = YES; //设置左边位置有效
64+
_underLineView.centerXPos.equalTo(@0).active = NO; //设置水平中间位置无效
65+
_underLineView.rightPos.equalTo(@0).active = NO; //设置右边位置无效
6166
[rootLayout addSubview:_underLineView];
6267

6368
MyBorderLineDraw *rootLayoutBld = [[MyBorderLineDraw alloc] initWithColor:[UIColor lightGrayColor]];
@@ -89,7 +94,8 @@ -(MyFrameLayout*)createItemLayout:(NSString*)title withTag:(NSInteger)tag
8994
titleLabel.text = title;
9095
titleLabel.font = [UIFont systemFontOfSize:15];
9196
[titleLabel sizeToFit];
92-
titleLabel.marginGravity = MyMarginGravity_Center; //标题尺寸由内容包裹,位置在布局视图中居中。
97+
titleLabel.centerXPos.equalTo(@0);
98+
titleLabel.centerYPos.equalTo(@0); //标题尺寸由内容包裹,位置在布局视图中居中。
9399
[itemLayout addSubview:titleLabel];
94100

95101
return itemLayout;
@@ -100,16 +106,22 @@ -(MyFrameLayout*)createItemLayout:(NSString*)title withTag:(NSInteger)tag
100106

101107
-(void)handleTap:(MyBaseLayout*)sender
102108
{
103-
//调整underLineView的marginGravity值来实现位置移动
109+
//调整underLineView的位置的有效值来实现位置移动。对于位置MyLayoutPos对象和尺寸对象MyLayoutSize来说有一个active属性来设置是否这个约束有效
104110
switch (sender.tag) {
105111
case 0:
106-
self.underLineView.marginGravity = MyMarginGravity_Vert_Bottom | MyMarginGravity_Horz_Left;
112+
self.underLineView.leftPos.active = YES;
113+
self.underLineView.centerXPos.active = NO;
114+
self.underLineView.rightPos.active = NO;
107115
break;
108116
case 1:
109-
self.underLineView.marginGravity = MyMarginGravity_Vert_Bottom | MyMarginGravity_Horz_Center;
117+
self.underLineView.leftPos.active = NO;
118+
self.underLineView.centerXPos.active = YES;
119+
self.underLineView.rightPos.active = NO;
110120
break;
111121
case 2:
112-
self.underLineView.marginGravity = MyMarginGravity_Vert_Bottom | MyMarginGravity_Horz_Right;
122+
self.underLineView.leftPos.active = NO;
123+
self.underLineView.centerXPos.active = NO;
124+
self.underLineView.rightPos.active = YES;
113125
break;
114126
default:
115127
NSAssert(0, @"oops!");

MyLayout/AllTest1ViewController.m

+1-2
Original file line numberDiff line numberDiff line change
@@ -144,8 +144,7 @@ -(void)createTableHeaderView
144144
label2.textColor = [CFTool color:4];
145145
label2.font = [CFTool font:15];
146146
label2.myLeftMargin = label2.myRightMargin = 5;
147-
label2.numberOfLines = 0;
148-
label2.flexedHeight = YES;
147+
label2.wrapContentHeight = YES;
149148
label2.myTopMargin = 10;
150149
[label2 sizeToFit];
151150
[tableHeaderViewLayout addSubview:label2];

MyLayout/AllTest2TableViewCell.m

+3-3
Original file line numberDiff line numberDiff line change
@@ -132,8 +132,8 @@ -(void)createLinearRootLayout
132132
_descLabel.textColor = [CFTool color:4];
133133
_descLabel.font = [CFTool font:15];
134134
_descLabel.adjustsFontSizeToFitWidth = YES;
135+
_descLabel.wrapContentHeight = YES; //2行高度,高度根据内容确定。
135136
_descLabel.numberOfLines = 2;
136-
_descLabel.flexedHeight = YES; //2行高度,高度根据内容确定。
137137
[userInfoLayout addSubview:_descLabel];
138138

139139

@@ -212,8 +212,8 @@ -(void)createRelativeRootLayout
212212
_descLabel.textColor = [CFTool color:4];
213213
_descLabel.font = [CFTool font:15];
214214
_descLabel.adjustsFontSizeToFitWidth = YES;
215+
_descLabel.wrapContentHeight = YES; //2行高度,高度根据内容确定。
215216
_descLabel.numberOfLines = 2;
216-
_descLabel.flexedHeight = YES; //2行高度,高度根据内容确定。
217217
_descLabel.leftPos.equalTo(_nameLabel.leftPos);
218218
_descLabel.rightPos.equalTo(_priceLabel.leftPos).offset(10);
219219
[rootLayout addSubview:_descLabel];
@@ -284,8 +284,8 @@ -(void)createFloatRootLayout
284284
_descLabel.textColor = [CFTool color:4];
285285
_descLabel.font = [CFTool font:15];
286286
_descLabel.adjustsFontSizeToFitWidth = YES;
287+
_descLabel.wrapContentHeight = YES; //2行高度,高度根据内容确定。
287288
_descLabel.numberOfLines = 2;
288-
_descLabel.flexedHeight = YES; //2行高度,高度根据内容确定。
289289
_descLabel.clearFloat = YES;
290290
_descLabel.weight = 1;
291291
[userInfoLayout addSubview:_descLabel];

0 commit comments

Comments
 (0)