Skip to content

Commit

Permalink
V1.2.8版本发布。
Browse files Browse the repository at this point in the history
  • Loading branch information
@欧柏泉 committed Nov 24, 2016
1 parent d243001 commit 20d702a
Show file tree
Hide file tree
Showing 5 changed files with 158 additions and 77 deletions.
6 changes: 3 additions & 3 deletions MyLayout.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ Pod::Spec.new do |s|
#

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

s.description = <<-DESC
*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.
Expand Down Expand Up @@ -79,7 +79,7 @@ Pod::Spec.new do |s|
# Supports git, hg, bzr, svn and HTTP.
#

s.source = { :git => "https://github.com/youngsoft/MyLinearLayout.git", :tag => "1.2.7" }
s.source = { :git => "https://github.com/youngsoft/MyLinearLayout.git", :tag => "1.2.8" }


# ――― Source Code ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
Expand Down
4 changes: 4 additions & 0 deletions MyLayout.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
186C530C1C75A5BB0031B2A2 /* MyFloatLayout.m in Sources */ = {isa = PBXBuildFile; fileRef = 186C530B1C75A5BB0031B2A2 /* MyFloatLayout.m */; };
1871D25F1D2F5ABA00D37F55 /* MyPathLayout.m in Sources */ = {isa = PBXBuildFile; fileRef = 1871D25E1D2F5ABA00D37F55 /* MyPathLayout.m */; };
188261CF1C647CB300996C2C /* AllTest6ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 188261CE1C647CB300996C2C /* AllTest6ViewController.m */; };
188D90E01DE736BB0034F76E /* MyLayoutClass.png in Resources */ = {isa = PBXBuildFile; fileRef = 188D90DF1DE736BB0034F76E /* MyLayoutClass.png */; };
1890A22F1C6DD71600373B8B /* FLLTest2ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 1890A22D1C6DD71600373B8B /* FLLTest2ViewController.m */; };
189692701CF74E7E000A5B91 /* AllTest2TableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 1896926F1CF74E7E000A5B91 /* AllTest2TableViewCell.m */; };
189692731CF74EA7000A5B91 /* AllTest1TableViewHeaderFooterView.m in Sources */ = {isa = PBXBuildFile; fileRef = 189692721CF74EA7000A5B91 /* AllTest1TableViewHeaderFooterView.m */; };
Expand Down Expand Up @@ -132,6 +133,7 @@
1888CE7F1D0BE44300968C0C /* layoutdemo3.gif */ = {isa = PBXFileReference; lastKnownFileType = image.gif; path = layoutdemo3.gif; sourceTree = "<group>"; };
1888CE801D0BE44300968C0C /* layoutdemo2.gif */ = {isa = PBXFileReference; lastKnownFileType = image.gif; path = layoutdemo2.gif; sourceTree = "<group>"; };
1888CE811D0BE44300968C0C /* layoutdemo1.gif */ = {isa = PBXFileReference; lastKnownFileType = image.gif; path = layoutdemo1.gif; sourceTree = "<group>"; };
188D90DF1DE736BB0034F76E /* MyLayoutClass.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = MyLayoutClass.png; sourceTree = "<group>"; };
1890A22C1C6DD71600373B8B /* FLLTest2ViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FLLTest2ViewController.h; sourceTree = "<group>"; };
1890A22D1C6DD71600373B8B /* FLLTest2ViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FLLTest2ViewController.m; sourceTree = "<group>"; };
1896926E1CF74E6A000A5B91 /* AllTest2TableViewCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AllTest2TableViewCell.h; sourceTree = "<group>"; };
Expand Down Expand Up @@ -307,6 +309,7 @@
186DF3701D523EDB00039E44 /* fl.png */,
186DF3711D523EDB00039E44 /* fll.png */,
186DF3721D523EDB00039E44 /* flo.png */,
188D90DF1DE736BB0034F76E /* MyLayoutClass.png */,
);
name = layoutpngs;
sourceTree = "<group>";
Expand Down Expand Up @@ -571,6 +574,7 @@
buildActionMask = 2147483647;
files = (
186B83E41D095A49001CA155 /* FOLTest1ViewController.xib in Resources */,
188D90E01DE736BB0034F76E /* MyLayoutClass.png in Resources */,
186B83DE1D090DE6001CA155 /* LaunchScreen.strings in Resources */,
186B83E01D094F11001CA155 /* FLLTest2ViewController.xib in Resources */,
186B83DF1D090DE6001CA155 /* Localizable.strings in Resources */,
Expand Down
Binary file added MyLayout/MyLayoutClass.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
103 changes: 67 additions & 36 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,70 @@
[![QQ](https://img.shields.io/badge/QQ-156355113-yellow.svg?style=flat)]()
[![GitHub stars](https://img.shields.io/github/stars/youngsoft/MyLinearLayout.svg)](https://github.com/youngsoft/MyLinearLayout/stargazers)

#MyLayout(2016.11.13)
##MyLayout(2016.11.25)

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)**

## Introduction
---
**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.**
##### ![cn](https://raw.githubusercontent.com/gosquared/flags/master/flags/flags/shiny/24/China.png) Chinese (Simplified): [中文说明](README.zh.md)

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

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

#### MyLayout's Swift version are named:[TangramKit](https://github.com/youngsoft/TangramKit)
## Usage

* 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.
* Subview A's left margin is 20% width of S, right margin is 30% width of S, height is equal to width of A.
* Subview B's left margin is 40, width is filled in to residual width of S,height is 40.
* Subview C's width is filled in to S, height is 40.
* Subview D's right margin is 20, width is 50% width of S, height is 40

![demo](https://raw.githubusercontent.com/youngsoft/TangramKit/master/TangramKit/usagedemo.png)


```objective-c

MyLinearLayout *S = [MyLinearLayout linearLayoutWithOrientation:MyLayoutViewOrientation_Vert];
S.subviewMargin = 10;
S.myWidth = 100;

UIView *A = UIView.new;
A.myLeftMargin = 0.2;
A.myRightMargin = 0.3;
A.heightDime.equalTo(A.widthDime);
[S addSubview:A];

UIView *B = UIView.new;
B.myLeftMargin = 40;
B.myWidth = 60;
B.myHeight = 40;
[S addSubview:B];

UIView *C = UIView.new;
C.myLeftMargin = C.myRightMargin = 0;
C.myHeight = 40;
[S addSubview:C];

UIView *D = UIView.new;
D.myRightMargin = 20;
D.widthDime.equalTo(S.widthDime).multiply(0.5);
D.myHeight = 40;
[S addSubview:D];


```
##Architecture
![demo](https://raw.githubusercontent.com/youngsoft/MyLinearLayout/master/MyLayout/MyLayoutClass.png)
###MyLayoutPos
`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;`
###MyLayoutSize
`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;`
#### ![cn](https://raw.githubusercontent.com/gosquared/flags/master/flags/flags/shiny/24/China.png) **Chinese (Simplified)**: [中文说明](README.zh.md)
---
### MyLinearLayout
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
the subviews arranged in left-to-right order is called horizontal linear layout.
Expand Down Expand Up @@ -59,9 +106,7 @@ D.myHeight = 40;
```

**MyLinearLayout be equivalent to LinearLayout of Android and UIStackView**

---
### MyRelativeLayout
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.

Expand Down Expand Up @@ -109,9 +154,8 @@ E.widthDime.equalTo(rootLayout.widthDime);
//...F,G

```
**MyRelativeLayout be equivalent to RelativeLayout of Android and AutoLayout**
---
### MyFrameLayout
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.
Expand Down Expand Up @@ -147,9 +191,7 @@ Sample code:
```

**MyFrameLayout be equivalent to FrameLayout of Android**

---
### MyTableLayout
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.

Expand Down Expand Up @@ -186,9 +228,6 @@ Sample code:

```
**MyTableLayout be equivalent to TableLayout of Android and table element of HTML**

---
### MyFlowLayout
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.
Expand All @@ -198,7 +237,7 @@ Flow layout is a layout view presents in multi-line that the subviews are arrang
Sample code:
```objective-c
MyFlowLayout *rootLayout = [MyFlowLayout flowLayoutWithOrientation:MyLayoutViewOrientation_Vert arrangedCount:3];
MyFlowLayout *rootLayout = [MyFlowLayout flowLayoutWithOrientation:MyLayoutViewOrientation_Vert arrangedCount:4];
rootLayout.wrapContentHeight = YES;
rootLayout.myWidth = 300;
rootLayout.averageArrange = YES;
Expand All @@ -215,9 +254,8 @@ Sample code:
```

**MyFlowLayout be equivalent to flexbox of CSS3**

---

### MyFloatLayout
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.

Expand Down Expand Up @@ -258,9 +296,7 @@ Sample code:

```
**MyFloatLayout be equivalent to float of CSS**
---
### MyPathLayout
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.
Expand All @@ -287,17 +323,14 @@ Sample code:
```

**MyPathLayout is only implement in MyLayout**
---


### MySizeClass
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.

**MySizeClass be equivalent to SizeClass of iOS**


## Demo sample
---

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


##How To Get Started
---

[Download MyLayout](https://github.com/youngsoft/MyLinearLayout/archive/master.zip) and try out the included iPad and iPhone example apps
Read FAQ, or articles below:

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


##Communication
---


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

## Installation
---

MyLayout supports multiple methods for installing the library in a project.
### Copy to your project
1. Copy `Lib` folder from the demo project to your project
Expand All @@ -353,7 +385,7 @@ To integrate MyLayout into your Xcode project using CocoaPods, specify it in you
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '7.0'
pod 'MyLayout', '~> 1.2.7'
pod 'MyLayout', '~> 1.2.8'
```

Then, run the following command:
Expand All @@ -365,7 +397,7 @@ Then, run the following command:


##FAQ
---

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


## License
---

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

Expand Down
Loading

0 comments on commit 20d702a

Please sign in to comment.