magi82 / Mgrelativekit
Licence: mit
Convert absolute to relative layout without autolayout.
Stars: ✭ 62
Programming Languages
swift
15916 projects
Labels
Projects that are alternatives of or similar to Mgrelativekit
Blueprints
🌀 Blueprints - A framework that is meant to make your life easier when working with collection view flow layouts.
Stars: ✭ 874 (+1309.68%)
Mutual labels: layout
Duo Navigation Drawer
A flexible, easy to use, unique drawer library for your Android project.
Stars: ✭ 986 (+1490.32%)
Mutual labels: layout
Keyboardlayoutguide
⌨️ Manage iOS keyboard with Apple's missing KeyboardLayoutGuide
Stars: ✭ 1,054 (+1600%)
Mutual labels: layout
Layout Spliter
Split label(horizontal,vertical),you can make a layout whatever you want !
Stars: ✭ 34 (-45.16%)
Mutual labels: layout
View shaper
A library to help create shaped views and layouts in Android
Stars: ✭ 42 (-32.26%)
Mutual labels: layout
Winterlayout
WinterLayout with the help of y = a*sin(x) function
Stars: ✭ 25 (-59.68%)
Mutual labels: layout
Spherelayout
a layout which supports 3d rotate and enable its childview has z-depth for android
Stars: ✭ 55 (-11.29%)
Mutual labels: layout
Readablebottombar
Yet another material bottom bar library for Android
Stars: ✭ 977 (+1475.81%)
Mutual labels: layout
Collectionviewpaginglayout
a simple but highly customizable paging layout for UICollectionView.
Stars: ✭ 947 (+1427.42%)
Mutual labels: layout
Ant Design Pro Layout
🌃 Powerful and easy to use beautiful layout
Stars: ✭ 967 (+1459.68%)
Mutual labels: layout
Masonry Layout
An efficient and fast web component that gives you a beautiful masonry layout
Stars: ✭ 43 (-30.65%)
Mutual labels: layout
Androidlibs
🔥正在成为史上最全分类 Android 开源大全~~~~(长期更新 Star 一下吧)
Stars: ✭ 7,148 (+11429.03%)
Mutual labels: layout
Capsicain
Powerful low-level keyboard remapping tool for Windows
Stars: ✭ 51 (-17.74%)
Mutual labels: layout
Wordpress Admin Style
Shows the WordPress admin styles on one page to help you to develop WordPress compliant
Stars: ✭ 871 (+1304.84%)
Mutual labels: layout
Framelayoutkit
FrameLayoutKit is a super fast and easy to use autolayout kit
Stars: ✭ 53 (-14.52%)
Mutual labels: layout
MGRelativeKit
Simple and easy API that converts absolute to relative layout without autolayout. ☀️
MGRelativekit uses the method chaining pattern to add view layouts.
It is recommended to use the 'apply' method for perfomance.
Usage Examples
- Example 1
view1.relativeLayout
.size(width: 100, height: 100)
.centerHorizontalSuper()
.alignSuperTop(padding: 100)
.apply()
view2.relativeLayout
.size(width: 100, height: 100)
.alignSuperRight(padding: 40)
.alignSuperBottom(padding: 40)
.apply()
- Example 2
view1.relativeLayout
.size(width: 100, height: 100)
.centerInSuper()
.apply()
view2.relativeLayout
.sizeOf(from: view1)
.topOf(from: view1)
.alignLeft(from: view1, padding: 30)
.apply()
- Example 3
view1.relativeLayout
.size(width: 200, height: 200)
.centerInSuper()
.apply()
view2.relativeLayout
.sizeOf(from: view1, margin: -100)
.centerOf(from: view1)
.apply()
API Reference
// ---------------------------------------------------------------------------
// Position the current view to the left of the relative view.
func leftOf(from: UIView, margin: CGFloat = 0)
// Position the current view to the right of the relative view.
func rightOf(from: UIView, margin: CGFloat = 0)
// Position the current view to the top of the relative view.
func topOf(from: UIView, margin: CGFloat = 0)
// Position the current view to the bottom of the relative view.
func bottomOf(from: UIView, margin: CGFloat = 0)
// ---------------------------------------------------------------------------
// Position the current view to the horizontal center of the relative view.
func centerHorizontalOf(from: UIView)
// Position the current view to the vertical center of the relative view.
func centerVerticalOf(from: UIView)
// Position the current view to the center of the relative view.
func centerOf(from: UIView)
// ---------------------------------------------------------------------------
// Position the current view to the left edge of the relative view.
func alignLeft(from: UIView, padding: CGFloat = 0)
// Position the current view to the right edge of the relative view.
func alignRight(from: UIView, padding: CGFloat = 0)
// Position the current view to the top edge of the relative view.
func alignTop(from: UIView, padding: CGFloat = 0)
// Position the current view to the bottom edge of the relative view.
func alignBottom(from: UIView, padding: CGFloat = 0)
// ---------------------------------------------------------------------------
// Position the current view to the left edge of the super view.
func alignSuperLeft(padding: CGFloat = 0)
// Position the current view to the right edge of the super view.
func alignSuperRight(padding: CGFloat = 0)
// Position the current view to the top edge of the super view.
func alignSuperTop(padding: CGFloat = 0)
// Position the current view to the bottom edge of the super view.
func alignSuperBottom(padding: CGFloat = 0)
// ---------------------------------------------------------------------------
// Position the current view to the horizontal center of the super view.
func centerHorizontalSuper()
// Position the current view to the vertical center of the super view.
func centerVerticalSuper()
// Position the current view to the center of the super view.
func centerInSuper()
// ---------------------------------------------------------------------------
// Apply the same size as the super view.
func sizeOfSuper(margin: CGFloat = 0)
// Apply the same size as the relative view.
func sizeOf(from: UIView, margin: CGFloat = 0)
// Apply custom size to the current view.
func size(width: CGFloat, height: CGFloat)
// Apply the same width size as the super view.
func widthOfSuper()
// Apply the same width size as the relative view.
func widthOf(from: UIView)
// Apply custom width size to the current view.
func width(_ width: CGFloat)
// Apply the same height size as the super view.
func heightOfSuper()
// Apply the same height size as the relative view.
func heightOf(from: UIView)
// Apply custom height size to the current view.
func height(_ height: CGFloat)
// ---------------------------------------------------------------------------
// Finalize the changed layout to the current view.
func apply()
Requirements
- Swift 3.0+
- Xcode 8.0+
- iOS 8.0+
Installation
- For iOS 8+ projects with CocoaPods:
pod 'MGRelativeKit'
- For iOS 8+ projects with Carthage:
github "magi82/MGRelativeKit"
Author
magi82, [email protected]
License
MGRelativeKit is available under the MIT license. See the LICENSE file for more info.
Note that the project description data, including the texts, logos, images, and/or trademarks,
for each open source project belongs to its rightful owner.
If you wish to add or remove any projects, please contact us at [email protected].