Skip to content

Commit ac10ae7

Browse files
author
@欧柏泉
committed
V1.2.3版本的更新:提供了一种新的界面布局MyPathLayout以及其他功能的添加和完善、代码优化并支持子视图的坐标变换处理。
1 parent 6e93322 commit ac10ae7

32 files changed

+3243
-502
lines changed

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.2.2"
19+
s.version = "1.2.3"
2020
s.summary = "A powerful iOS view layout library, suitable for all kinds of screen size. Don't need to learn AutoLayout and SizeClass. "
2121

2222
s.description = <<-DESC
@@ -79,7 +79,7 @@ Pod::Spec.new do |s|
7979
# Supports git, hg, bzr, svn and HTTP.
8080
#
8181

82-
s.source = { :git => "https://github.com/youngsoft/MyLinearLayout.git", :tag => "1.2.2" }
82+
s.source = { :git => "https://github.com/youngsoft/MyLinearLayout.git", :tag => "1.2.3" }
8383

8484

8585
# ――― Source Code ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #

MyLayout.xcodeproj/project.pbxproj

+32
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,15 @@
1818
186B83E01D094F11001CA155 /* FLLTest2ViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 186B83E21D094F11001CA155 /* FLLTest2ViewController.xib */; };
1919
186B83E41D095A49001CA155 /* FOLTest1ViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 186B83E61D095A49001CA155 /* FOLTest1ViewController.xib */; };
2020
186C530C1C75A5BB0031B2A2 /* MyFloatLayout.m in Sources */ = {isa = PBXBuildFile; fileRef = 186C530B1C75A5BB0031B2A2 /* MyFloatLayout.m */; };
21+
1871D25F1D2F5ABA00D37F55 /* MyPathLayout.m in Sources */ = {isa = PBXBuildFile; fileRef = 1871D25E1D2F5ABA00D37F55 /* MyPathLayout.m */; };
2122
188261CF1C647CB300996C2C /* AllTest6ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 188261CE1C647CB300996C2C /* AllTest6ViewController.m */; };
2223
1890A22F1C6DD71600373B8B /* FLLTest2ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 1890A22D1C6DD71600373B8B /* FLLTest2ViewController.m */; };
2324
189692701CF74E7E000A5B91 /* AllTest2TableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 1896926F1CF74E7E000A5B91 /* AllTest2TableViewCell.m */; };
2425
189692731CF74EA7000A5B91 /* AllTest1TableViewHeaderFooterView.m in Sources */ = {isa = PBXBuildFile; fileRef = 189692721CF74EA7000A5B91 /* AllTest1TableViewHeaderFooterView.m */; };
2526
189692761CF74EC5000A5B91 /* AllTestDataModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 189692751CF74EC5000A5B91 /* AllTestDataModel.m */; };
2627
18BCC51A1D2D4885005081FF /* FLLTest4ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 18BCC5191D2D4885005081FF /* FLLTest4ViewController.m */; };
28+
18C8F1641D4DA6B800DC1FD3 /* PLTest3ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 18C8F1631D4DA6B800DC1FD3 /* PLTest3ViewController.m */; };
29+
18C8F1671D4E3E4E00DC1FD3 /* PLTest4ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 18C8F1661D4E3E4E00DC1FD3 /* PLTest4ViewController.m */; };
2730
18CFFA2E1D0723970032A789 /* TLTest3ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 18CFFA2D1D0723970032A789 /* TLTest3ViewController.m */; };
2831
18D684301C4F421400A48BB4 /* AllTest1ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 18D683E81C4F421400A48BB4 /* AllTest1ViewController.m */; };
2932
18D684311C4F421400A48BB4 /* AllTest2ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 18D683EA1C4F421400A48BB4 /* AllTest2ViewController.m */; };
@@ -61,6 +64,8 @@
6164
18D684591C4F423400A48BB4 /* MyLayoutTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 18D684551C4F423400A48BB4 /* MyLayoutTests.m */; };
6265
18DBC56A1CFB451800BD73D2 /* FOLTest4ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 18DBC5691CFB451800BD73D2 /* FOLTest4ViewController.m */; };
6366
18DC7F551CF5510F008E5FCB /* AllTest1TableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 18DC7F541CF5510F008E5FCB /* AllTest1TableViewCell.m */; };
67+
18E7C5181D47A1CA00F61A3E /* PLTest1ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 18E7C5171D47A1CA00F61A3E /* PLTest1ViewController.m */; };
68+
18E7C51B1D47BA9400F61A3E /* PLTest2ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 18E7C51A1D47BA9400F61A3E /* PLTest2ViewController.m */; };
6469
18E8084D1B3A5D170059C410 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 18E8084C1B3A5D170059C410 /* QuartzCore.framework */; };
6570
18EA81451CFFD3E90006530A /* FOLTest5ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 18EA81441CFFD3E90006530A /* FOLTest5ViewController.m */; };
6671
46D45B161C525FC400A8362C /* MyLayoutSizeClass.m in Sources */ = {isa = PBXBuildFile; fileRef = 46D45B151C525FC400A8362C /* MyLayoutSizeClass.m */; };
@@ -99,6 +104,8 @@
99104
186B83E71D095A54001CA155 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/FOLTest1ViewController.xib; sourceTree = "<group>"; };
100105
186C530A1C75A5BB0031B2A2 /* MyFloatLayout.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MyFloatLayout.h; sourceTree = "<group>"; };
101106
186C530B1C75A5BB0031B2A2 /* MyFloatLayout.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MyFloatLayout.m; sourceTree = "<group>"; };
107+
1871D25D1D2F5ABA00D37F55 /* MyPathLayout.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MyPathLayout.h; sourceTree = "<group>"; };
108+
1871D25E1D2F5ABA00D37F55 /* MyPathLayout.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MyPathLayout.m; sourceTree = "<group>"; };
102109
188261CD1C647CB300996C2C /* AllTest6ViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AllTest6ViewController.h; sourceTree = "<group>"; };
103110
188261CE1C647CB300996C2C /* AllTest6ViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AllTest6ViewController.m; sourceTree = "<group>"; };
104111
1888CE7C1D0BE44300968C0C /* layoutdemo6.gif */ = {isa = PBXFileReference; lastKnownFileType = image.gif; path = layoutdemo6.gif; sourceTree = "<group>"; };
@@ -117,6 +124,11 @@
117124
189692751CF74EC5000A5B91 /* AllTestDataModel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AllTestDataModel.m; sourceTree = "<group>"; };
118125
18BCC5181D2D4879005081FF /* FLLTest4ViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FLLTest4ViewController.h; sourceTree = "<group>"; };
119126
18BCC5191D2D4885005081FF /* FLLTest4ViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FLLTest4ViewController.m; sourceTree = "<group>"; };
127+
18BF0BE41D5109C300395960 /* layoutdemo7.gif */ = {isa = PBXFileReference; lastKnownFileType = image.gif; path = layoutdemo7.gif; sourceTree = "<group>"; };
128+
18C8F1621D4DA6B800DC1FD3 /* PLTest3ViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PLTest3ViewController.h; sourceTree = "<group>"; };
129+
18C8F1631D4DA6B800DC1FD3 /* PLTest3ViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PLTest3ViewController.m; sourceTree = "<group>"; };
130+
18C8F1651D4E3E4E00DC1FD3 /* PLTest4ViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PLTest4ViewController.h; sourceTree = "<group>"; };
131+
18C8F1661D4E3E4E00DC1FD3 /* PLTest4ViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PLTest4ViewController.m; sourceTree = "<group>"; };
120132
18CFFA2C1D0723870032A789 /* TLTest3ViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TLTest3ViewController.h; sourceTree = "<group>"; };
121133
18CFFA2D1D0723970032A789 /* TLTest3ViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TLTest3ViewController.m; sourceTree = "<group>"; };
122134
18D683E71C4F421400A48BB4 /* AllTest1ViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = AllTest1ViewController.h; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; };
@@ -195,6 +207,10 @@
195207
18DBC5691CFB451800BD73D2 /* FOLTest4ViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FOLTest4ViewController.m; sourceTree = "<group>"; };
196208
18DC7F531CF5510F008E5FCB /* AllTest1TableViewCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AllTest1TableViewCell.h; sourceTree = "<group>"; };
197209
18DC7F541CF5510F008E5FCB /* AllTest1TableViewCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AllTest1TableViewCell.m; sourceTree = "<group>"; };
210+
18E7C5161D47A1CA00F61A3E /* PLTest1ViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PLTest1ViewController.h; sourceTree = "<group>"; };
211+
18E7C5171D47A1CA00F61A3E /* PLTest1ViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PLTest1ViewController.m; sourceTree = "<group>"; };
212+
18E7C5191D47BA9400F61A3E /* PLTest2ViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PLTest2ViewController.h; sourceTree = "<group>"; };
213+
18E7C51A1D47BA9400F61A3E /* PLTest2ViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PLTest2ViewController.m; sourceTree = "<group>"; };
198214
18E8084C1B3A5D170059C410 /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; };
199215
18EA81431CFFD3DD0006530A /* FOLTest5ViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FOLTest5ViewController.h; sourceTree = "<group>"; };
200216
18EA81441CFFD3E90006530A /* FOLTest5ViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FOLTest5ViewController.m; sourceTree = "<group>"; };
@@ -346,6 +362,14 @@
346362
18DBC5691CFB451800BD73D2 /* FOLTest4ViewController.m */,
347363
18EA81431CFFD3DD0006530A /* FOLTest5ViewController.h */,
348364
18EA81441CFFD3E90006530A /* FOLTest5ViewController.m */,
365+
18E7C5161D47A1CA00F61A3E /* PLTest1ViewController.h */,
366+
18E7C5171D47A1CA00F61A3E /* PLTest1ViewController.m */,
367+
18E7C5191D47BA9400F61A3E /* PLTest2ViewController.h */,
368+
18E7C51A1D47BA9400F61A3E /* PLTest2ViewController.m */,
369+
18C8F1621D4DA6B800DC1FD3 /* PLTest3ViewController.h */,
370+
18C8F1631D4DA6B800DC1FD3 /* PLTest3ViewController.m */,
371+
18C8F1651D4E3E4E00DC1FD3 /* PLTest4ViewController.h */,
372+
18C8F1661D4E3E4E00DC1FD3 /* PLTest4ViewController.m */,
349373
);
350374
path = MyLayout;
351375
sourceTree = "<group>";
@@ -369,6 +393,8 @@
369393
18D684121C4F421400A48BB4 /* MyRelativeLayout.m */,
370394
186C530A1C75A5BB0031B2A2 /* MyFloatLayout.h */,
371395
186C530B1C75A5BB0031B2A2 /* MyFloatLayout.m */,
396+
1871D25D1D2F5ABA00D37F55 /* MyPathLayout.h */,
397+
1871D25E1D2F5ABA00D37F55 /* MyPathLayout.m */,
372398
18D684071C4F421400A48BB4 /* MyLayoutInner.h */,
373399
18D684041C4F421400A48BB4 /* MyLayoutDime.h */,
374400
18D684061C4F421400A48BB4 /* MyLayoutDimeInner.h */,
@@ -400,6 +426,7 @@
400426
18F83FBD1C4F6EB7003EF090 /* Supporting Files */ = {
401427
isa = PBXGroup;
402428
children = (
429+
18BF0BE41D5109C300395960 /* layoutdemo7.gif */,
403430
1888CE7C1D0BE44300968C0C /* layoutdemo6.gif */,
404431
1888CE7D1D0BE44300968C0C /* layoutdemo5.gif */,
405432
1888CE7E1D0BE44300968C0C /* layoutdemo4.gif */,
@@ -536,9 +563,12 @@
536563
18D6843C1C4F421400A48BB4 /* MyFrameLayout.m in Sources */,
537564
18EA81451CFFD3E90006530A /* FOLTest5ViewController.m in Sources */,
538565
18D684521C4F421400A48BB4 /* ViewController.m in Sources */,
566+
18C8F1671D4E3E4E00DC1FD3 /* PLTest4ViewController.m in Sources */,
539567
18D684511C4F421400A48BB4 /* TLTest2ViewController.m in Sources */,
568+
18E7C5181D47A1CA00F61A3E /* PLTest1ViewController.m in Sources */,
540569
18D684301C4F421400A48BB4 /* AllTest1ViewController.m in Sources */,
541570
18D684311C4F421400A48BB4 /* AllTest2ViewController.m in Sources */,
571+
18E7C51B1D47BA9400F61A3E /* PLTest2ViewController.m in Sources */,
542572
18D684491C4F421400A48BB4 /* LLTest5ViewController.m in Sources */,
543573
18D684331C4F421400A48BB4 /* AllTest4ViewController.m in Sources */,
544574
189692731CF74EA7000A5B91 /* AllTest1TableViewHeaderFooterView.m in Sources */,
@@ -559,9 +589,11 @@
559589
18D684361C4F421400A48BB4 /* FLLTest1ViewController.m in Sources */,
560590
18D684481C4F421400A48BB4 /* LLTest4ViewController.m in Sources */,
561591
18D684431C4F421400A48BB4 /* MyRelativeLayout.m in Sources */,
592+
18C8F1641D4DA6B800DC1FD3 /* PLTest3ViewController.m in Sources */,
562593
18D684451C4F421400A48BB4 /* LLTest1ViewController.m in Sources */,
563594
18DBC56A1CFB451800BD73D2 /* FOLTest4ViewController.m in Sources */,
564595
18296B6F1C76D55B00273C3E /* FOLTest1ViewController.m in Sources */,
596+
1871D25F1D2F5ABA00D37F55 /* MyPathLayout.m in Sources */,
565597
189692761CF74EC5000A5B91 /* AllTestDataModel.m in Sources */,
566598
46DB7E6B1C54B4BC001B409D /* AllTest5ViewController.m in Sources */,
567599
18D6844B1C4F421400A48BB4 /* LLTest7ViewController.m in Sources */,

MyLayout/AppDelegate.m

+1
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(
3232

3333
UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:vc];
3434
nav.navigationBar.translucent = NO;
35+
nav.toolbar.translucent = NO;
3536
self.window.rootViewController = nav;
3637

3738
[self.window makeKeyAndVisible];

MyLayout/Lib/MyBaseLayout.h

+16-6
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
#import "MyLayoutDime.h"
1212
#import "MyLayoutSizeClass.h"
1313

14+
@class MyBaseLayout;
15+
1416

1517
@interface UIView(MyLayoutExt)
1618

@@ -40,6 +42,8 @@
4042
|Vert MyFloatLayout | - | T,B,R,L | - | - | - | - | - |
4143
|--------------------+------------------+----------------------+---------------+-----------+--------------------+-------+-------|
4244
|Horz MyFloatLayout | - | T,B,R,L | - | - | - | - | - |
45+
|--------------------+------------------+----------------------+---------------+-----------+--------------------+-------+-------|
46+
|MyPathLayout | - | T,L | - | - | - | - | - |
4347
+--------------------+------------------+----------------------+---------------+-----------+--------------------+-------+-------+
4448
4549
*上面表格中L=leftPos, R=rightPos, T=topPos, B=bottomPos,CX=centerXPos,CY=centerYPos,ALL是所有布局位置对象,-表示不支持。
@@ -196,15 +200,15 @@
196200
为了表示方便我们把:
197201
线性布局简写为L、垂直线性布局简写为L-V、水平线性布局简写为L-H 相对布局简写为R、表格布局简写为T、框架布局简写为FR、
198202
流式布局简写为FL、垂直流式布局简写为FL-V,水平流式布局简写为FL-H、浮动布局简写为FO、左右浮动布局简写为FO-V、上下浮动布局简写为FO-H、
199-
全部简写为ALL,不支持为-,
203+
路径布局简写为P、全部简写为ALL,不支持为-,
200204
201205
定义A为操作的视图本身,B为A的兄弟视图,P为A的父视图。
202206
+-------------+----------+------------------+--------------+------------+--------------+---------------+--------------+----------------------+
203207
| 对象 \ 值 | NSNumber |A.widthDime |A.heightDime |B.widthDime | B.heightDime | P.widthDime |P.heightDime |NSArray<MyLayoutDime*>|
204208
+-------------+----------+------------------+--------------+------------+--------------+---------------+--------------+----------------------+
205-
|A.widthDime | ALL |ALL |FR/R/FL-H/FO |FR/R/FO | R |L/FR/R/FL/FO | R |R |
209+
|A.widthDime | ALL |ALL |FR/R/FL-H/FO |FR/R/FO/P | R |L/FR/R/FL/FO/P | R |R |
206210
+-------------+----------+------------------+--------------+------------+--------------+---------------+--------------+----------------------+
207-
|A.heightDime | ALL |FR/R/FL-V/FO/L-V |ALL |R |FR/R/FO |R |L/FR/R/FL/FO |R |
211+
|A.heightDime | ALL |FR/R/FL-V/FO/L-V |ALL |R |FR/R/FO/P |R |L/FR/R/FL/FO/P|R |
208212
+-------------+----------+------------------+--------------+------------+--------------+---------------+--------------+----------------------+
209213
210214
上表中所有的布局尺寸的值都支持设置为数值,而且所有布局下的子视图的宽度和高度尺寸都可以设置为等于自身的宽度和高度尺寸,布局库这里做了特殊处理,是不会造成循环引用的。比如:
@@ -275,6 +279,12 @@
275279
@property(nonatomic, assign) IBInspectable BOOL noLayout;
276280

277281

282+
/**
283+
*视图在布局视图中布局完成后执行的块,执行完block后会被重置为nil。通过在viewLayoutCompleteBlock中我们可以得到这个视图真实的frame值。还可以设置一些属性,主要是用来实现一些动画特效。
284+
*/
285+
@property(nonatomic,copy) void (^viewLayoutCompleteBlock)(MyBaseLayout* layout, UIView *v);
286+
287+
278288
/**
279289
*视图的评估Rect值。评估的Rect值是在布局前评估计算的值,而frame则是视图真正完成布局后的真实的Rect值。在调用这个方法前请先调用父布局视图的-(CGRect)estimateLayoutRect方法进行布局视图的尺寸评估,否则此方法返回的值未可知。这个方法主要用于在视图布局前而想得到其在父布局视图中的Rect值的场景。
280290
*/
@@ -353,11 +363,11 @@
353363
@property(nonatomic, assign) IBInspectable BOOL reverseLayout;
354364

355365

356-
357366
/**
358-
*把一个布局视图放入到UIScrollView内时是否自动调整UIScrollView的contentSize值,默认是YES。你可以将这个属性设置NO而不调整contentSize的值,要设置这个属性值为NO请在将布局视图添加到UIScrollView以后再设置才能生效
367+
*把一个布局视图放入到UIScrollView内时是否自动调整UIScrollView的contentSize值。默认是MyLayoutAdjustScrollViewContentSizeModeAuto,你可以将这个属性设置NO而不调整contentSize的值,设置为YES则一定会调整contentSize.
359368
*/
360-
@property(nonatomic, assign, getter = isAdjustScrollViewContentSize) BOOL adjustScrollViewContentSize;
369+
@property(nonatomic, assign) MyLayoutAdjustScrollViewContentSizeMode adjustScrollViewContentSizeMode;
370+
@property(nonatomic, assign, getter = isAdjustScrollViewContentSize) BOOL adjustScrollViewContentSize MYDEPRECATED("use adjustScrollViewContentSizeMode to instead");
361371

362372

363373
/**

0 commit comments

Comments
 (0)