All Projects → netyouli → Whc_autolayoutkit

netyouli / Whc_autolayoutkit

Licence: mit
iOS and Mac OS X platforms currently in use the fastest the simplest development to build the UI layout automatically open source library, strong dynamic layout constraint handling capacity,iOS/Mac OS X平台上目前使用最简单开发构建UI速度最快的自动布局开源库,强悍的动态布局约束处理能力

Projects that are alternatives of or similar to Whc autolayoutkit

DailyNews
Daily News is a news app with good looking user interface ! Apps architecture is MVVM and used RxSwift for binding.
Stars: ✭ 31 (-96.39%)
Mutual labels:  autolayout
Autoinch
优雅的iPhone全尺寸/等比例精准适配工具
Stars: ✭ 395 (-53.96%)
Mutual labels:  autolayout
Markupkit
Declarative UI for iOS and tvOS
Stars: ✭ 508 (-40.79%)
Mutual labels:  autolayout
Stevia
🍃 Concise Autolayout code
Stars: ✭ 3,182 (+270.86%)
Mutual labels:  autolayout
Easyswiftlayout
Lightweight Swift framework for Apple's Auto-Layout
Stars: ✭ 345 (-59.79%)
Mutual labels:  autolayout
Mylinearlayout
MyLayout is a powerful iOS UI framework implemented by Objective-C. It integrates the functions with Android Layout,iOS AutoLayout,SizeClass, HTML CSS float and flexbox and bootstrap. So you can use LinearLayout,RelativeLayout,FrameLayout,TableLayout,FlowLayout,FloatLayout,PathLayout,GridLayout,LayoutSizeClass to build your App 自动布局 UIView UITab…
Stars: ✭ 4,152 (+383.92%)
Mutual labels:  autolayout
RangeUISlider
📱 🔵➖🔵 An iOS range selection slider compatible with UIKit and SwiftUI. Developed using autolayout and highly customizable using IBDesignabled and IBInspectable or programmatically. It support also RTL (right to left) languages automatically out of the box.
Stars: ✭ 98 (-88.58%)
Mutual labels:  autolayout
Autolayoutexamplewithmasonry
Different Autolayout examples with Masonry. 用Masonry写的Autolayout案例,持续更新中。详细解答请看tutuge.me
Stars: ✭ 694 (-19.11%)
Mutual labels:  autolayout
Uitableviewdynamiclayoutcacheheight
🖖高性能的自动计算采用 Autolayout 布局的 UITableViewCell 和 UITableViewHeaderFooterView 的高度,内部自动管理高度缓存。
Stars: ✭ 360 (-58.04%)
Mutual labels:  autolayout
Android Ratiolayout
This is a specified proportion to the size of the Layout or View support library, with which you can easily set a fixed ratio of the size of the Layout or View, internal adaptive size calculation, completely abandon the code to calculate the size! If you have any questions in the course or suggestions, please send an e-mail to the following e-mail, thank you!
Stars: ✭ 462 (-46.15%)
Mutual labels:  autolayout
Misterfusion
MisterFusion is Swift DSL for AutoLayout. It is the extremely clear, but concise syntax, in addition, can be used in both Swift and Objective-C. Support Safe Area and Size Class.
Stars: ✭ 314 (-63.4%)
Mutual labels:  autolayout
Snapkit
A Swift Autolayout DSL for iOS & OS X
Stars: ✭ 18,091 (+2008.51%)
Mutual labels:  autolayout
Easyanchor
⚓️ Declarative, extensible, powerful Auto Layout
Stars: ✭ 432 (-49.65%)
Mutual labels:  autolayout
Align
Intuitive and powerful Auto Layout library
Stars: ✭ 261 (-69.58%)
Mutual labels:  autolayout
Tablekit
Type-safe declarative table views.
Stars: ✭ 567 (-33.92%)
Mutual labels:  autolayout
Restaurant-Viewing-App
Build A Restaurant Viewing App in Swift 4.2
Stars: ✭ 43 (-94.99%)
Mutual labels:  autolayout
Uicollectionview Layouts Kit
📐 A set of custom layouts for UICollectionView with examples [Swift 5.3, iOS 12].
Stars: ✭ 410 (-52.21%)
Mutual labels:  autolayout
Color Picker For Ios
Colorful: iOS color picker built with Swift.
Stars: ✭ 709 (-17.37%)
Mutual labels:  autolayout
Autoflowlayout
自定义ViewGroup,实现多功能流式布局与网格布局
Stars: ✭ 660 (-23.08%)
Mutual labels:  autolayout
Toolbar
Awesome autolayout Toolbar. Toolbar is a library for iOS. You can easily create chat InputBar.
Stars: ✭ 458 (-46.62%)
Mutual labels:  autolayout

WHC_AutoLayout

Build Status Platform Pod Version Pod License

  • iOS and Mac OS X platforms currently in use the fastest the simplest development to build the UI layout automatically open source library, strong dynamic layout constraint handling capacity
  • Service to update constraints, convenient and quick dynamic UI layout.

Swift4.+ version 👉 WHC_Layout

修改ios11安全布局机制增加whc_IsSafe控制api 布局api内部自动支持兼容处理iphonex头部齐刘海和底部黑线

添加UILayoutGuide,safeAreaLayoutGuide约束支持

重构布局核心升级基于二叉树层遍历算法搜索约束主视图,对于自动处理跨视图层复杂约束关系更健壮可靠

添加抗拉伸和抗压缩api支持链式调用

Introduce

  • Adopt chain layout Api calls convenient
  • Include one line of code to calculate UITableViewCell highly module
  • Contains WHC_StackView module (UIStackView purpose alternative system)
  • Automatic identification of the same type conflict and update the new constraints
  • Support change constraints priority
  • Support delete constraints
  • Support iOS and Mac OS X
  • Automatic covering and modify the conflict with type constraints

Require

  • iOS 8.0+ / Mac OS X 10.11+ / tvOS 9.0+
  • Xcode 8.0 or later

Note

  • When the view call removeFromSuperview the view must call whc_ResetConstraints to clear the cache constraint

Install

  • CocoaPods: pod 'WHC_AutoLayoutKit'

Usage

UILayoutGuide,safeAreaLayoutGuide

UILayoutGuide * guide = UILayoutGuide.new;
UIView * view = UIView.new;

guide.whc_LeftSpace(10)
.whc_TopSpaceToView(0, self.view.safeAreaLayoutGuide)
.whc_RightSpace(10)
.whc_Height(30);

view.whc_LeftSpace(10)
.whc_RightSpace(10)
.whc_TopSpaceToView(0, guide)
.whc_Height(50);

Automatic height view

view.whc_LeftSpace(10)
    .whc_TopSpace(10)
    .whc_RightSpace(10)
    .whc_HeightAuto();

Use lessEqual or greaterEqual (width <= 100 && width >= 20)

view.whc_Width(100).whc_LessOrEqual()
    .whc_Width(20).whc_GreaterOrEqual()

Masonry/SnapKit update the constraint way unfriendly

[view mas_updateConstraints:^(MASConstraintMaker *make) {
    make.top.equalTo(superview.mas_top).with.offset(10); 
    make.left.equalTo(superview.mas_left).with.offset(20);
    make.bottom.equalTo(superview.mas_bottom).with.offset(-10);
    make.right.equalTo(superview.mas_right).with.offset(-10);
}];

Update the view constraints

Modify the view to the left from 20 other views

view.whc_LeftSpace(20);
// or
view.whc_LeftSpaceToView(20,otherView);

Can be directly modified constraints on the Xib and Storyboard

If the view of xib leading now amended as left constraints

/// First remove the xib view of leading and then add new constraints
view.whc_RemoveLayoutAttrs(NSLayoutAttributeLeading)
    .whc_LeftSpace(10);

Remove the constraint

Remove all constraints associated with view left

view.whc_RemoveLayoutAttrs(NSLayoutAttributeLeft);

To remove multiple constraints associated with view

view.whc_RemoveLayoutAttrs(NSLayoutAttributeLeft,NSLayoutAttributeLeading,NSLayoutAttributeTop);
// or 
view.whc_RemoveTo(linkView, attrs: NSLayoutAttributeLeft ...);

Modify the view constraint priority

Modify the view constraint for low priority right

view.whc_RightSpace(10)
    .whc_PriorityLow();
// The higher the priority, the less likely to be stretched
// 设置抗拉伸优先级,优先级越高越不容易被拉伸
label.whc_ContentHuggingPriority(UILayoutPriorityDefaultLow, UILayoutConstraintAxisHorizontal);

// 设置抗压缩优先级,优先级越高越不容易被压缩
// Compression priority, the higher the priority the less easy to be compressed
label.whc_ContentCompressionResistancePriority(UILayoutPriorityDefaultLow, UILayoutConstraintAxisHorizontal);

One line of code calculation cell height

No reuse way calculated cell height

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
    return [UITableViewCell whc_CellHeightForIndexPath:indexPath tableView:tableView];
}

Reuse way calculated cell height

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
    return [UITableViewCell whc_CellHeightForIndexPath:indexPath 
                                             tableView:tableView 
                                            identifier:@"kFirendsCircleCellIdentifier" 
                                           layoutBlock:^(UITableViewCell *cell) {
         /// use model layout cell
         [(FriendsCircleCell *)cell setFriendModel:_friendModelArray[indexPath.row]];
    }];
}

Use WHC_StackView

Create WHC_StackView

WHC_StackView * stackView = [WHC_StackView new];
[self.view addSubview: stackView];

Add constraint

stackView.whc_LeftSpace(10)
         .whc_TopSpace(10)
         .whc_RightSpace(10)
         .whc_HeightAuto();

Configuration stackView

1. Set the padding

stackView.whc_Edge = UIEdgeInsetsMake(10, 10, 10, 10); // 内边距

2. Set the layout direction

stackView.whc_Orientation = Vertical;                  // 自动垂直布局

3. Set the child views lateral clearance

stackView.whc_HSpace = 10;                             // 子视图横向间隙

4. Set the child views vertical clearance

stackView.whc_VSpace = 10;                             // 子视图垂直间隙

5. Add subview and start the layout

for (int i = 0; i < 4; i++) {
    UIView * view = [UIView new];
    [stackView addSubview:view];        
}
[stackView whc_StartLayout];

Prompt

For more UI layout automatically, WHC_StackView components, one line of code to calculate the cell height module, please download this demo to check the specific usage

Part of the WHC_AutoLayoutKit demo show

image

Licenses

All source code is licensed under the MIT License.

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].