Skip to content

Commit fa22ac6

Browse files
author
@欧柏泉
committed
release v1.3.4
1 parent f1539ba commit fa22ac6

File tree

99 files changed

+1648
-665
lines changed

Some content is hidden

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

99 files changed

+1648
-665
lines changed

CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,17 @@
33

44
---
55

6+
## [V1.3.4](https://github.com/youngsoft/MyLinearLayout/releases/tag/1.3.4)(2017/3/04)
7+
8+
#### Added
9+
1. 布局视图添加了新方法`-(CGRect)subview:(UIView*)subview estimatedRectInLayoutSize:(CGSize)size`用来评估一个将要加入布局视图的子视图的frame值。这个方法通常用来实现一些子视图在布局视图之间移动的动画效果的能力。具体例子参见(DEMO:AllTest4ViewController
10+
11+
####Changed
12+
1. 优化了当将一个布局视图作为视图控制器的根视图时(self.view)的一些属性设置可能导致约束冲突,和可能导致将控制器中的视图加入到一个滚动视图时无法滚动的问题。
13+
2. 将线性布局`MyLinearLayout`中的shrinkType属性的默认值由原来的`MySubviewsShrink_Average`改为了`MySubviewsShrink_None`,也就是默认是不压缩的。
14+
3. 修正了相对布局中的子视图设置`useFrame`为YES时,子视图无法自由控制自己的frame的问题。
15+
4. 优化了所有类以及方法和属性以及各种类型的注释,注释更加清晰明了。同时优化了所有DEMO中的注释信息。
16+
5. 在布局视图以及一些扩展视图中增加了IBInspectable标识,以便更好的和XIB以及SB编程结合。
617

718
## [V1.3.3](https://github.com/youngsoft/MyLinearLayout/releases/tag/1.3.3)(2017/2/24)
819

MyLayout.podspec

Lines changed: 2 additions & 2 deletions
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.3"
19+
s.version = "1.3.4"
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.3" }
78+
s.source = { :git => "https://github.com/youngsoft/MyLinearLayout.git", :tag => "1.3.4" }
7979

8080

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

MyLayout.xcodeproj/project.pbxproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@
8181
18E8084D1B3A5D170059C410 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 18E8084C1B3A5D170059C410 /* QuartzCore.framework */; };
8282
18EA81451CFFD3E90006530A /* FOLTest5ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 18EA81441CFFD3E90006530A /* FOLTest5ViewController.m */; };
8383
18EDEC811D64B70D00F8B1CD /* FOLTest6ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 18EDEC801D64B70D00F8B1CD /* FOLTest6ViewController.m */; };
84+
18FE40B01E6AA709001E8007 /* MyLayout.png in Resources */ = {isa = PBXBuildFile; fileRef = 18FE40AF1E6AA709001E8007 /* MyLayout.png */; };
8485
46D45B161C525FC400A8362C /* MyLayoutSizeClass.m in Sources */ = {isa = PBXBuildFile; fileRef = 46D45B151C525FC400A8362C /* MyLayoutSizeClass.m */; };
8586
46DB7E6B1C54B4BC001B409D /* AllTest5ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 46DB7E6A1C54B4BC001B409D /* AllTest5ViewController.m */; };
8687
/* End PBXBuildFile section */
@@ -266,6 +267,7 @@
266267
18EA81441CFFD3E90006530A /* FOLTest5ViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FOLTest5ViewController.m; sourceTree = "<group>"; };
267268
18EDEC801D64B70D00F8B1CD /* FOLTest6ViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FOLTest6ViewController.m; sourceTree = "<group>"; };
268269
18EDEC821D64B71900F8B1CD /* FOLTest6ViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FOLTest6ViewController.h; sourceTree = "<group>"; };
270+
18FE40AF1E6AA709001E8007 /* MyLayout.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = MyLayout.png; sourceTree = "<group>"; };
269271
46D45B141C525FC400A8362C /* MyLayoutSizeClass.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MyLayoutSizeClass.h; sourceTree = "<group>"; };
270272
46D45B151C525FC400A8362C /* MyLayoutSizeClass.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MyLayoutSizeClass.m; sourceTree = "<group>"; };
271273
46DB7E691C54B4BC001B409D /* AllTest5ViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AllTest5ViewController.h; sourceTree = "<group>"; };
@@ -604,6 +606,7 @@
604606
1888CE7F1D0BE44300968C0C /* layoutdemo3.gif */,
605607
1888CE801D0BE44300968C0C /* layoutdemo2.gif */,
606608
1888CE811D0BE44300968C0C /* layoutdemo1.gif */,
609+
18FE40AF1E6AA709001E8007 /* MyLayout.png */,
607610
186B83D91D090DE6001CA155 /* zh-Hans.lproj */,
608611
186B83CE1D08F7B9001CA155 /* Base.lproj */,
609612
18D683F91C4F421400A48BB4 /* Images.xcassets */,
@@ -722,6 +725,7 @@
722725
188D90E01DE736BB0034F76E /* MyLayoutClass.png in Resources */,
723726
186B83DE1D090DE6001CA155 /* LaunchScreen.strings in Resources */,
724727
186B83E01D094F11001CA155 /* FLLTest2ViewController.xib in Resources */,
728+
18FE40B01E6AA709001E8007 /* MyLayout.png in Resources */,
725729
186B83DF1D090DE6001CA155 /* Localizable.strings in Resources */,
726730
186B83D41D08F7B9001CA155 /* LaunchScreen.xib in Resources */,
727731
18D684391C4F421400A48BB4 /* Images.xcassets in Resources */,

MyLayout/AllTest1ViewController.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//
2-
// Test9ViewController.h
2+
// AllTest1ViewController.h
33
// MyLayout
44
//
55
// Created by oybq on 15/6/21.
@@ -8,6 +8,9 @@
88

99
#import <UIKit/UIKit.h>
1010

11+
/**
12+
*1.UITableView - Dynamic height
13+
*/
1114
@interface AllTest1ViewController : UITableViewController
1215

1316
@end

MyLayout/AllTest1ViewController.m

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//
2-
// Test9ViewController.m
2+
// AllTest1ViewController.m
33
// MyLayout
44
//
55
// Created by oybq on 15/6/21.
@@ -198,6 +198,7 @@ -(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)
198198

199199
-(UITableViewCell*)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
200200
{
201+
//如果使用了布局来评估cell高度的话,那么请不要使用- (__kindof UITableViewCell *)dequeueReusableCellWithIdentifier:(NSString *)identifier forIndexPath:(NSIndexPath *)indexPath 这个方法,否则可能造成系统崩溃!!!
201202
AllTest1TableViewCell *cell = (AllTest1TableViewCell*)[tableView dequeueReusableCellWithIdentifier:@"alltest1_cell"];
202203
if (cell == nil)
203204
cell = [[AllTest1TableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"alltest1_cell"];

MyLayout/AllTest2ViewController.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@
88

99
#import <UIKit/UIKit.h>
1010

11-
11+
/**
12+
*2.UITableView - Static height
13+
*/
1214
@interface AllTest2ViewController : UITableViewController
1315

1416
@end

MyLayout/AllTest3ViewController.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
//
2-
// Test12ViewController.h
2+
// AllTest3ViewController.h
33
// MyLayout
44
//
55
// Created by oybq on 15/6/24.
66
// Copyright (c) 2015年 YoungSoft. All rights reserved.
77
//
88

99
#import <UIKit/UIKit.h>
10-
10+
/**
11+
*3.Replacement of UITableView
12+
*/
1113
@interface AllTest3ViewController : UIViewController
1214

1315
@end

MyLayout/AllTest4ViewController.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//
2-
// Test15ViewController.h
2+
// AllTest4ViewController.h
33
// MyLayout
44
//
55
// Created by oybq on 15/7/6.
@@ -9,7 +9,7 @@
99
#import <UIKit/UIKit.h>
1010

1111
/**
12-
* 用MyLayout来实现UICollectionView的方法。
12+
* 4.Replacement of UICollectionView
1313
*/
1414
@interface AllTest4ViewController : UIViewController
1515

MyLayout/AllTest4ViewController.m

Lines changed: 73 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//
2-
// Test15ViewController.m
2+
// AllTest4ViewController.m
33
// MyLayout
44
//
55
// Created by oybq on 15/7/6.
@@ -178,9 +178,10 @@ -(UIView*)createCellLayout1:(NSString*)image title:(NSString*)title
178178

179179
#pragma mark -- HandleMethod
180180

181-
-(void)handleCellLayoutTap:(UIView*)sender
181+
182+
//显示点击提示框
183+
-(void)showClikAlert:(UIView*)sender inFlowLayout:(MyFlowLayout*)flowLayout
182184
{
183-
184185
NSInteger supplementaryIndex = sender.tag / sBaseTag;
185186
NSInteger cellIndex = sender.tag % sBaseTag;
186187

@@ -189,7 +190,75 @@ -(void)handleCellLayoutTap:(UIView*)sender
189190
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:nil message:message delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil];
190191

191192
[alertView show];
192-
193+
}
194+
195+
196+
-(void)exchangeSubview:(UIView*)sender from:(MyBaseLayout*)fromLayout to:(MyBaseLayout*)toLayout
197+
{
198+
//往下移动时,有可能会上面缩小而下面整体往上移动,结束位置不正确。 也就是移动的视图开始位置正确,结束位置不正确。
199+
//往上移动时,有可能会上面撑大而下面整体往下移动,开始位置不正确。 也就是移动的视图开始位置不正确,结束位置正确。
200+
//因此为了解决这个问题,我们在删除子视图时不让布局视图进行布局,这可以通过设置布局视图的autoresizesSubviews为NO。
201+
202+
203+
//得到当前的sender在self.view中的frame,这里进行坐标的转换。
204+
CGRect rectOld = [fromLayout convertRect:sender.frame toView:self.view];
205+
206+
//得到将sender加入到toLayout后的评估的frame值,注意这时候sender还没有加入到toLayout。因为是加入到最后面,因此只能用这个方法来评估加入后的值,如果不是添加到最后则是可以很简单的得到应该插入的位置的。
207+
CGRect rectNew = [toLayout subview:sender estimatedRectInLayoutSize:CGSizeZero];
208+
rectNew = [toLayout convertRect:rectNew toView:self.view]; //将新位置的评估的frame值,进行坐标转换。
209+
210+
//在动画的过程中,我们将sender作为self.view的子视图来实现移动的效果。
211+
fromLayout.autoresizesSubviews = NO;
212+
[sender removeFromSuperview];
213+
sender.frame = rectOld;
214+
sender.useFrame = YES; //设置为YES表示sender不再受到布局视图的约束,而是可以自由设置frame值。
215+
[self.view addSubview:sender];
216+
217+
[UIView animateWithDuration:0.3 animations:^{
218+
219+
sender.frame = rectNew;
220+
221+
} completion:^(BOOL finished) {
222+
223+
//恢复重新布局。
224+
fromLayout.autoresizesSubviews = YES;
225+
[fromLayout setNeedsLayout];
226+
227+
//动画结束后再将sender移植到toLayout中。
228+
[sender removeFromSuperview];
229+
sender.useFrame = NO; //还原useFrame,因为加入到toLayout后将受到布局视图的约束。
230+
[toLayout addSubview:sender];
231+
232+
}];
233+
234+
235+
}
236+
237+
-(void)handleCellLayoutTap:(UIView*)sender
238+
{
239+
//这里是为了节省,所以将两个不同的功能放在一起。。。
240+
241+
MyFlowLayout *superFlowLayout = (MyFlowLayout*)sender.superview;
242+
243+
//第一个和第二个里面的子视图点击后弹出当前点击的cell的提示信息。
244+
if (superFlowLayout == self.containerLayouts[0] || superFlowLayout == self.containerLayouts[1])
245+
{
246+
[self showClikAlert:sender inFlowLayout:superFlowLayout];
247+
}
248+
else
249+
{
250+
//第三个第四个里面的子视图点击后进行互相移动的场景。
251+
MyFlowLayout *flowLayout2 = self.containerLayouts[2];
252+
MyFlowLayout *flowLayout3 = self.containerLayouts[3];
253+
if (superFlowLayout == flowLayout2)
254+
{
255+
[self exchangeSubview:sender from:flowLayout2 to:flowLayout3];
256+
}
257+
else
258+
{
259+
[self exchangeSubview:sender from:flowLayout3 to:flowLayout2];
260+
}
261+
}
193262
}
194263

195264
-(void)handleReverse:(id)sender

MyLayout/AllTest5ViewController.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@
88

99
#import <UIKit/UIKit.h>
1010

11+
/**
12+
*1.SizeClass - Demo1
13+
*/
1114
@interface AllTest5ViewController : UIViewController
1215

1316
@end

0 commit comments

Comments
 (0)