Skip to content

Commit 20d702a

Browse files
author
@欧柏泉
committed
V1.2.8版本发布。
1 parent d243001 commit 20d702a

File tree

5 files changed

+158
-77
lines changed

5 files changed

+158
-77
lines changed

MyLayout.podspec

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

1818
s.name = "MyLayout"
19-
s.version = "1.2.7"
20-
s.summary = "MyLayout is A powerful iOS UI framework. It integrated the Android layout,AutoLayout,SizeClass, HTML/CSS float and flexbox functions."
19+
s.version = "1.2.8"
20+
s.summary = "MyLayout is a powerful iOS UI framework. It integrated the Android layout,AutoLayout,SizeClass, HTML/CSS float and flexbox functions."
2121

2222
s.description = <<-DESC
2323
*MyLayout is a powerful iOS UI layout framework which is not an encapsulation based on the AutoLayout but is based on primary frame property and by overwriting the layoutSubview method to realize the subview's layout.
@@ -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.7" }
82+
s.source = { :git => "https://github.com/youngsoft/MyLinearLayout.git", :tag => "1.2.8" }
8383

8484

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

MyLayout.xcodeproj/project.pbxproj

+4
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
186C530C1C75A5BB0031B2A2 /* MyFloatLayout.m in Sources */ = {isa = PBXBuildFile; fileRef = 186C530B1C75A5BB0031B2A2 /* MyFloatLayout.m */; };
2424
1871D25F1D2F5ABA00D37F55 /* MyPathLayout.m in Sources */ = {isa = PBXBuildFile; fileRef = 1871D25E1D2F5ABA00D37F55 /* MyPathLayout.m */; };
2525
188261CF1C647CB300996C2C /* AllTest6ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 188261CE1C647CB300996C2C /* AllTest6ViewController.m */; };
26+
188D90E01DE736BB0034F76E /* MyLayoutClass.png in Resources */ = {isa = PBXBuildFile; fileRef = 188D90DF1DE736BB0034F76E /* MyLayoutClass.png */; };
2627
1890A22F1C6DD71600373B8B /* FLLTest2ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 1890A22D1C6DD71600373B8B /* FLLTest2ViewController.m */; };
2728
189692701CF74E7E000A5B91 /* AllTest2TableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 1896926F1CF74E7E000A5B91 /* AllTest2TableViewCell.m */; };
2829
189692731CF74EA7000A5B91 /* AllTest1TableViewHeaderFooterView.m in Sources */ = {isa = PBXBuildFile; fileRef = 189692721CF74EA7000A5B91 /* AllTest1TableViewHeaderFooterView.m */; };
@@ -132,6 +133,7 @@
132133
1888CE7F1D0BE44300968C0C /* layoutdemo3.gif */ = {isa = PBXFileReference; lastKnownFileType = image.gif; path = layoutdemo3.gif; sourceTree = "<group>"; };
133134
1888CE801D0BE44300968C0C /* layoutdemo2.gif */ = {isa = PBXFileReference; lastKnownFileType = image.gif; path = layoutdemo2.gif; sourceTree = "<group>"; };
134135
1888CE811D0BE44300968C0C /* layoutdemo1.gif */ = {isa = PBXFileReference; lastKnownFileType = image.gif; path = layoutdemo1.gif; sourceTree = "<group>"; };
136+
188D90DF1DE736BB0034F76E /* MyLayoutClass.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = MyLayoutClass.png; sourceTree = "<group>"; };
135137
1890A22C1C6DD71600373B8B /* FLLTest2ViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FLLTest2ViewController.h; sourceTree = "<group>"; };
136138
1890A22D1C6DD71600373B8B /* FLLTest2ViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FLLTest2ViewController.m; sourceTree = "<group>"; };
137139
1896926E1CF74E6A000A5B91 /* AllTest2TableViewCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AllTest2TableViewCell.h; sourceTree = "<group>"; };
@@ -307,6 +309,7 @@
307309
186DF3701D523EDB00039E44 /* fl.png */,
308310
186DF3711D523EDB00039E44 /* fll.png */,
309311
186DF3721D523EDB00039E44 /* flo.png */,
312+
188D90DF1DE736BB0034F76E /* MyLayoutClass.png */,
310313
);
311314
name = layoutpngs;
312315
sourceTree = "<group>";
@@ -571,6 +574,7 @@
571574
buildActionMask = 2147483647;
572575
files = (
573576
186B83E41D095A49001CA155 /* FOLTest1ViewController.xib in Resources */,
577+
188D90E01DE736BB0034F76E /* MyLayoutClass.png in Resources */,
574578
186B83DE1D090DE6001CA155 /* LaunchScreen.strings in Resources */,
575579
186B83E01D094F11001CA155 /* FLLTest2ViewController.xib in Resources */,
576580
186B83DF1D090DE6001CA155 /* Localizable.strings in Resources */,

MyLayout/MyLayoutClass.png

318 KB
Loading

README.md

+67-36
Original file line numberDiff line numberDiff line change
@@ -6,23 +6,70 @@
66
[![QQ](https://img.shields.io/badge/QQ-156355113-yellow.svg?style=flat)]()
77
[![GitHub stars](https://img.shields.io/github/stars/youngsoft/MyLinearLayout.svg)](https://github.com/youngsoft/MyLinearLayout/stargazers)
88

9-
#MyLayout(2016.11.13)
9+
##MyLayout(2016.11.25)
1010

11+
MyLayout is a simple and easy objective-c framework for iOS view layout. MyLayout provides some simple functions to build a variety of complex interface. It integrates the functions including: Autolayout and SizeClass of iOS, five layout classes of Android, float and flex-box and bootstrap of HTML/CSS. The MyLayout's Swift version are named: **[TangramKit](https://github.com/youngsoft/TangramKit)**
1112

12-
## Introduction
13-
---
14-
**MyLayout is a powerful iOS UI layout framework which is not an encapsulation based on the AutoLayout but is based on primary *frame* property and by overwriting the *layoutSubview* method to realize the subview's layout. So It is unlimited to run in any version of iOS system. Its idea and principle is referenced from the layout of the Android system, HTML/CSS float&flexbox, iOS AutoLayout and SizeClass. You can implement the UI layout through the seven kinds of layout class below: MyLinearLayout, MyRelativeLayout, MyFrameLayout MyTableLayout, MyFlowLayout,MyFloatLayout ,MyPathLayout and the support for SizeClass.**
13+
##### ![cn](https://raw.githubusercontent.com/gosquared/flags/master/flags/flags/shiny/24/China.png) Chinese (Simplified): [中文说明](README.zh.md)
1514

16-
**Powerful function, easy to use, barely constraint
17-
setting and fit various screen size perfectly are MyLayout's main advantages.**
1815

19-
**I hope you use MyLayout right now or in your next project will be happy!**
2016

21-
#### MyLayout's Swift version are named:[TangramKit](https://github.com/youngsoft/TangramKit)
17+
## Usage
18+
19+
* There is a container view S which width is 100 and height is wrap to all subviews height. there are four subviews A,B,C,D arranged from top to bottom.
20+
* Subview A's left margin is 20% width of S, right margin is 30% width of S, height is equal to width of A.
21+
* Subview B's left margin is 40, width is filled in to residual width of S,height is 40.
22+
* Subview C's width is filled in to S, height is 40.
23+
* Subview D's right margin is 20, width is 50% width of S, height is 40
24+
25+
![demo](https://raw.githubusercontent.com/youngsoft/TangramKit/master/TangramKit/usagedemo.png)
26+
27+
28+
```objective-c
29+
30+
MyLinearLayout *S = [MyLinearLayout linearLayoutWithOrientation:MyLayoutViewOrientation_Vert];
31+
S.subviewMargin = 10;
32+
S.myWidth = 100;
33+
34+
UIView *A = UIView.new;
35+
A.myLeftMargin = 0.2;
36+
A.myRightMargin = 0.3;
37+
A.heightDime.equalTo(A.widthDime);
38+
[S addSubview:A];
39+
40+
UIView *B = UIView.new;
41+
B.myLeftMargin = 40;
42+
B.myWidth = 60;
43+
B.myHeight = 40;
44+
[S addSubview:B];
45+
46+
UIView *C = UIView.new;
47+
C.myLeftMargin = C.myRightMargin = 0;
48+
C.myHeight = 40;
49+
[S addSubview:C];
50+
51+
UIView *D = UIView.new;
52+
D.myRightMargin = 20;
53+
D.widthDime.equalTo(S.widthDime).multiply(0.5);
54+
D.myHeight = 40;
55+
[S addSubview:D];
56+
57+
58+
```
59+
60+
61+
##Architecture
62+
63+
![demo](https://raw.githubusercontent.com/youngsoft/MyLinearLayout/master/MyLayout/MyLayoutClass.png)
64+
65+
###MyLayoutPos
66+
`MyLayoutPos` is represent to the position of a view. UIView provides six extension variables:leftPos, topPos, bottomPos, rightPos, centerXPos, centerYPos to set view's margin or space distance between self and others. You can use `equalTo` method to set NSNumber or MyLayoutPos or NSArray<MyLayoutPos*> value. there are six simple variables:myLeftMargin,myTopMargin,myBottomMargin,myRightMargin,myCenterXOffset,myCenterYOffset use to set NSNumber value. eg. `A.leftPos.equalTo(@10); <==> A.myLeftMargin = 10;`
67+
68+
69+
###MyLayoutSize
70+
`MyLayoutSize` is represent to the size of a view. UIView provides two extension variables:widthDime,heightDime to set view's width and height dimension. You can use `equalTo` method to set NSNumber or MyLayoutSize or NSArray<MyLayoutSize*> value. there are two simple variables: myWidth, myHeight use to set NSNumber value. eg. `A.widthDime.equalTo(@10); <==> A.myWidth = 10;`
2271
23-
#### ![cn](https://raw.githubusercontent.com/gosquared/flags/master/flags/flags/shiny/24/China.png) **Chinese (Simplified)**: [中文说明](README.zh.md)
2472
25-
---
2673
### MyLinearLayout
2774
Linear layout is a single line layout view that the subviews are arranged in sequence according to the added order(from top to bottom or from left to right). So the subviews' origin&size constraints are established by the added order. Subviews arranged in top-to-bottom order is called vertical linear layout view, and
2875
the subviews arranged in left-to-right order is called horizontal linear layout.
@@ -59,9 +106,7 @@ D.myHeight = 40;
59106
60107
```
61108

62-
**MyLinearLayout be equivalent to LinearLayout of Android and UIStackView**
63109

64-
---
65110
### MyRelativeLayout
66111
Relative layout is a layout view that the subviews layout and position through mutual constraints.The subviews in the relative layout are not depended to the adding order but layout and position by setting the subviews' constraints.
67112

@@ -109,9 +154,8 @@ E.widthDime.equalTo(rootLayout.widthDime);
109154
//...F,G
110155

111156
```
112-
**MyRelativeLayout be equivalent to RelativeLayout of Android and AutoLayout**
113157
114-
---
158+
115159
### MyFrameLayout
116160
Frame layout is a layout view that the subviews can be overlapped and gravity in a special location of the superview.The subviews' layout position&size is not depended to the adding order and establish dependency constraint with the superview. Frame layout devided the vertical orientation to top,vertical center and bottom, while horizontal orientation is devided to left,horizontal center and right. Any of the subviews is just gravity in either vertical orientation or horizontal orientation.
117161
@@ -147,9 +191,7 @@ Sample code:
147191
148192
```
149193

150-
**MyFrameLayout be equivalent to FrameLayout of Android**
151194

152-
---
153195
### MyTableLayout
154196
Table layout is a layout view that the subviews are multi-row&col arranged like a table. First you must create a rowview and add it to the table layout, then add the subview to the rowview. If the rowviews arranged in top-to-bottom order,the tableview is caled vertical table layout,in which the subviews are arranged from left to right; If the rowviews arranged in in left-to-right order,the tableview is caled horizontal table layout,in which the subviews are arranged from top to bottom.
155197

@@ -186,9 +228,6 @@ Sample code:
186228

187229
```
188230
189-
**MyTableLayout be equivalent to TableLayout of Android and table element of HTML**
190-
191-
---
192231
193232
### MyFlowLayout
194233
Flow layout is a layout view presents in multi-line that the subviews are arranged in sequence according to the added order, and when meeting with a arranging constraint it will start a new line and rearrange. The constrains mentioned here includes count constraints and size constraints. The orientation of the new line would be vertical and horizontal, so the flow layout is divided into: count constraints vertical flow layout, size constraints vertical flow layout, count constraints horizontal flow layout, size constraints horizontal flow layout. Flow layout often used in the scenes that the subviews is arranged regularly, it can be substitutive of UICollectionView to some extent. the MyFlowLayout is almost implement the flex-box function of the HTML/CSS.
@@ -198,7 +237,7 @@ Flow layout is a layout view presents in multi-line that the subviews are arrang
198237
Sample code:
199238
200239
```objective-c
201-
MyFlowLayout *rootLayout = [MyFlowLayout flowLayoutWithOrientation:MyLayoutViewOrientation_Vert arrangedCount:3];
240+
MyFlowLayout *rootLayout = [MyFlowLayout flowLayoutWithOrientation:MyLayoutViewOrientation_Vert arrangedCount:4];
202241
rootLayout.wrapContentHeight = YES;
203242
rootLayout.myWidth = 300;
204243
rootLayout.averageArrange = YES;
@@ -215,9 +254,8 @@ Sample code:
215254
216255
```
217256

218-
**MyFlowLayout be equivalent to flexbox of CSS3**
219257

220-
---
258+
221259
### MyFloatLayout
222260
Float layout is a layout view that the subviews are floating gravity in the given orientations, when the size is not enough to be hold, it will automatically find the best location to gravity. float layout's conception is reference from the HTML/CSS's floating positioning technology, so the float layout can be designed in implementing irregular layout. According to the different orientation of the floating, float layout can be divided into left-right float layout and up-down float layout.
223261

@@ -258,9 +296,7 @@ Sample code:
258296

259297
```
260298
261-
**MyFloatLayout be equivalent to float of CSS**
262299
263-
---
264300
### MyPathLayout
265301
Path layout is a layout view that the subviews are according to a specified path curve to layout. You must provide a type of Functional equation,a coordinate and a type of distance setting to create a Path Curve than all subview are equidistance layout in the Path layout. path layout usually used to create some irregular and gorgeous UI layout.
266302
@@ -287,17 +323,14 @@ Sample code:
287323
288324
```
289325

290-
**MyPathLayout is only implement in MyLayout**
291-
292-
---
326+
327+
293328
### MySizeClass
294329
MyLayout provided support to SizeClass in order to fit the different screen sizes of devices. You can combinate the SizeClass with any of the 6 kinds of layout views mentioned above to perfect fit the UI of all equipments.
295330

296-
**MySizeClass be equivalent to SizeClass of iOS**
297331

298332

299333
## Demo sample
300-
---
301334

302335
![演示效果图](https://raw.githubusercontent.com/youngsoft/MyLinearLayout/master/MyLayout/layoutdemo1.gif)
303336
![演示效果图](https://raw.githubusercontent.com/youngsoft/MyLinearLayout/master/MyLayout/layoutdemo2.gif)
@@ -306,11 +339,10 @@ MyLayout provided support to SizeClass in order to fit the different screen size
306339
![演示效果图](https://raw.githubusercontent.com/youngsoft/MyLinearLayout/master/MyLayout/layoutdemo5.gif)
307340
![演示效果图](https://raw.githubusercontent.com/youngsoft/MyLinearLayout/master/MyLayout/layoutdemo6.gif)
308341
![演示效果图](https://raw.githubusercontent.com/youngsoft/MyLinearLayout/master/MyLayout/layoutdemo7.gif)
309-
![演示效果图](https://raw.githubusercontent.com/youngsoft/MyLinearLayout/master/MyLayout/layoutdemo8.gif)
310342

311343

312344
##How To Get Started
313-
---
345+
314346
[Download MyLayout](https://github.com/youngsoft/MyLinearLayout/archive/master.zip) and try out the included iPad and iPhone example apps
315347
Read FAQ, or articles below:
316348

@@ -326,7 +358,7 @@ Because my english is poor so I just only can support chinese articles,and I w
326358

327359

328360
##Communication
329-
---
361+
330362

331363
- If you need help, use Stack Overflow or Baidu. (Tag 'mylayout')
332364
- If you'd like to contact me, use *qq:156355113 or weibo:欧阳大哥 or email:obq0387_cn@sina.com*
@@ -335,7 +367,7 @@ Because my english is poor so I just only can support chinese articles,and I w
335367
- If you want to contribute, submit a pull request.
336368

337369
## Installation
338-
---
370+
339371
MyLayout supports multiple methods for installing the library in a project.
340372
### Copy to your project
341373
1. Copy `Lib` folder from the demo project to your project
@@ -353,7 +385,7 @@ To integrate MyLayout into your Xcode project using CocoaPods, specify it in you
353385
source 'https://github.com/CocoaPods/Specs.git'
354386
platform :ios, '7.0'
355387
356-
pod 'MyLayout', '~> 1.2.7'
388+
pod 'MyLayout', '~> 1.2.8'
357389
```
358390

359391
Then, run the following command:
@@ -365,7 +397,7 @@ Then, run the following command:
365397

366398

367399
##FAQ
368-
---
400+
369401
* If you use MyLayout runtime cause 100% CPU usage said appeared constraint conflict, please check the subview's constraint set.
370402
* If you use MyLayout exception crashed in MyBaseLayout *willMoveToSuperview* method. it does not matter, just remove the exception break setting in CMD+7.
371403
* If you set wrapConentWidth or wrapContentHeight while set widthDime or heightDime in layout view may be constraint conflict。
@@ -375,7 +407,6 @@ Then, run the following command:
375407

376408

377409
## License
378-
---
379410

380411
MyLayout is released under the MIT license. See LICENSE for details.
381412

0 commit comments

Comments
 (0)