CUSLayout
CUSLayout for iOS managed positioning mechanism, the iOS SDK provides absolute positioning is very inconvenient to use, in addition to the emergence of 4-inch screen of the iPhone and iPad to make iOS developer need to spend more time in the layout, however iOS6.0 AutoLayout the mechanism is disappointing, I refer to Android, SWT, Swing layout mechanism, the preparation of for iOS CUSLayout, use CUSLayout has the following advantages:
- Simplify coding, you do not need to take into account the pixel level, only for regional programming, which greatly improves the efficiency of programming
- Good readability, layout type can be a preliminary understanding of layout intent and child controls roughly placed, eliminating the need for a very tedious restore coordinate steps
- When the the UIView container Flip, size change, supporting multiple resolutions, automatic processing
- UIView category which makes it easy to create layout constraints in old code
- The API is simple and easy-to-use, low cost learning through the sample program to preliminary master
How To Get Started
###Use static library
-
1.Open your existing project (or create a new one)
-
2.Drag and drop the CUSLayoutExample.xcodeproj file downloaded from github previously from Finder to your project (either root or under Frameworks)
-
3.In YOUR project configuration:
in the Build Phases, Add CUSLayout (the lib, not the example app) as a Target Dependency
in the Link Binary With Libraries section, add the libCUSLayout.a library -
4.In YOUR Prefix.pch file, add:
#import “CUSLayout.h”
-
5.In YOUR project configuration, on the “Build Settings” tab
-
locate the “User Header Search Paths” setting, and set the Release value to "${PROJECT_DIR}/CUSLayout" (including quotes!) and check the “Recursive” check box.
-
The Debug value should already be set, but if it’s not, change that as well.
-
Also locate the “Always Search User Paths” value and set it to YES.
-
Finally, find the “Other Linker Flags” option, and add the value -ObjC (no quotes).
Installation with CocoaPods
CocoaPods is a dependency manager for Objective-C, which automates and simplifies the process of using 3rd-party libraries like CUSLayout in your projects. See the "Getting Started" guide for more information.
Podfile
platform:ios
pod "CUSLayout"
API
###Base Layout
CUSFillLayout
CUSStackLayout
CUSLinnerLayout
###Advanced Layout
CUSRowLayout
CUSTableLayout
CUSGridLayout
Basic usage
###CUSFillLayout
//only one code,auto set the frame of parent to the subview.
view.layoutFrame = [[CUSFillLayout alloc]init];
Example
License
CUSLayout is licensed under the terms of the Apache License, version 2.0. Please see the LICENSE file for full details.
Contributions
Contributions are totally welcome. We'll review all pull requests and if you send us a good one/are interested we're happy to give you push access to the repo. Or, you know, you could just come work with us.
Please pay attention to add Star, your support is my greatest motivation, thank you.