All Projects → JunyuKuang → Extendededges

JunyuKuang / Extendededges

Licence: mit
A simple and easy way to keep your custom views properly layout on iPhone X.

Programming Languages

swift
15916 projects

Labels

Projects that are alternatives of or similar to Extendededges

Flex Layout
Provides HTML UI layout for Angular applications; using Flexbox and a Responsive API
Stars: ✭ 5,705 (+18303.23%)
Mutual labels:  layout
Flexbox
CSS library for easier work with flex boxes
Stars: ✭ 17 (-45.16%)
Mutual labels:  layout
Wordpress Admin Style
Shows the WordPress admin styles on one page to help you to develop WordPress compliant
Stars: ✭ 871 (+2709.68%)
Mutual labels:  layout
Flex Layout Attribute
HTML layout helper based on CSS flexbox specification —
Stars: ✭ 705 (+2174.19%)
Mutual labels:  layout
Styled System
⬢ Style props for rapid UI development
Stars: ✭ 7,126 (+22887.1%)
Mutual labels:  layout
Atomic Layout
Physical representation of layout composition to create declarative responsive layouts in React.
Stars: ✭ 920 (+2867.74%)
Mutual labels:  layout
Front End Daily Challenges
As of October 2020, 170+ works have been accomplished, challenge yourself each day!
Stars: ✭ 598 (+1829.03%)
Mutual labels:  layout
Image Relocation
Docker/OCI image relocation
Stars: ✭ 21 (-32.26%)
Mutual labels:  layout
Greedo Layout For Ios
Full aspect ratio grid layout for iOS
Stars: ✭ 837 (+2600%)
Mutual labels:  layout
Winterlayout
WinterLayout with the help of y = a*sin(x) function
Stars: ✭ 25 (-19.35%)
Mutual labels:  layout
Paralayout
Paralayout is a set of simple, useful, and straightforward utilities that enable pixel-perfect layout in iOS. Your designers will love you.
Stars: ✭ 742 (+2293.55%)
Mutual labels:  layout
Statefullayout
Android layout to show template for loading, empty, error etc. states
Stars: ✭ 813 (+2522.58%)
Mutual labels:  layout
Fluentlayout
Stars: ✭ 23 (-25.81%)
Mutual labels:  layout
Physicslayout
Android layout that simulates physics using JBox2D
Stars: ✭ 658 (+2022.58%)
Mutual labels:  layout
Blueprints
🌀 Blueprints - A framework that is meant to make your life easier when working with collection view flow layouts.
Stars: ✭ 874 (+2719.35%)
Mutual labels:  layout
Driveway
pure CSS masonry layouts
Stars: ✭ 607 (+1858.06%)
Mutual labels:  layout
Windless
Windless makes it easy to implement invisible layout loading view.
Stars: ✭ 919 (+2864.52%)
Mutual labels:  layout
Collectionviewpaginglayout
a simple but highly customizable paging layout for UICollectionView.
Stars: ✭ 947 (+2954.84%)
Mutual labels:  layout
Androidlibs
🔥正在成为史上最全分类 Android 开源大全~~~~(长期更新 Star 一下吧)
Stars: ✭ 7,148 (+22958.06%)
Mutual labels:  layout
Tree layout
Algorithms to layout trees in a pretty manner.
Stars: ✭ 24 (-22.58%)
Mutual labels:  layout

ExtendedEdges

A simple and easy way to keep your custom views properly layout on iPhone X.

Demo video: YouTube

Requirement

  • Xcode 9.0+
  • Swift 4.0+
  • iOS 9.0+

Installation

  1. Download the project
  2. Open the project, then drag the UIView+ExtendedEdges.swift file into your project.

Usages

The APIs are simple. Use 2 properties to configure extended edges, and 2 (optional) properties to configure separator. Check ViewController.swift in project for detail usages.

public extension UIView {

    enum Edge {
        case top
        case leading
        case trailing
        case bottom
    }
}

public extension UIView {

    /// The view's edges that need to extended.
    ///
    /// The default value is an empty set, which means not extend any edges.
    var extendedEdges: Set<Edge> { get set }

    /// The view's background view that extend to superview's edge.
    ///
    /// The default value is a view with clear background color.
    var backgroundViewForEdgeExtension: UIView { get set }
}

public extension UIView {

    /// The view's edge to place separator.
    ///
    /// Default value is `Edge.top`, which means place separator at the view's top edge.
    ///
    /// Set a new value will create and add a new separator to the view if current don't have one.
    var separatorEdge: Edge { get set }

    /// The separator view for indicated `separatorEdge`.
    ///
    /// The default value is a view with background color `UIColor.black.withAlphaComponent(0.3)` (iOS standard separator color).
    var separator: UIView { get set }
}

Example

let yourCustomToolbar = UIView()
view.addSubview(yourCustomToolbar)

// configure Auto Layout constraints
yourCustomToolbar.translatesAutoresizingMaskIntoConstraints = false
NSLayoutConstraint.activate([
    yourCustomToolbar.leadingAnchor.constraint(equalTo: view.layoutMarginsGuide.leadingAnchor),
    yourCustomToolbar.trailingAnchor.constraint(equalTo: view.layoutMarginsGuide.trailingAnchor),
    yourCustomToolbar.bottomAnchor.constraint(equalTo: view.layoutMarginsGuide.bottomAnchor),
    yourCustomToolbar.heightAnchor.constraint(equalToConstant: 64),
    ])

// configure extended edges and background view
yourCustomToolbar.extendedEdges = [.leading, .trailing, .bottom]
yourCustomToolbar.backgroundViewForEdgeExtension = UIVisualEffectView(effect: UIBlurEffect(style: .extraLight))

// add a separator to view's top edge
yourCustomToolbar.separatorEdge = .top

License - MIT

Copyright (c) 2017 Junyu Kuang [email protected]

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

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