A flexible container view featuring a solid background with rounded corners.

Related tags

UI TOBorderView
Overview

CI Version GitHub license Platform

TOBorderView is a very basic container UIKit component that wraps custom view content inside a solid colored rectangle with rounded corners. It automatically handles correctly insetting the content, as well as managing the internal view hierarchy in order to guarantee maximum performance with Core Animation.

Starting with iOS 11, and to a much greater extent on Big Sur, the design language on Apple's platforms has become such that separating content by enclosing it in rounded rectangles has become preferable to using high contrast hairline separators. As thisis becoming the case, it made sense to create one high quality reusable component to achieve this, than simply recreating it whenever it is needed.

Features

  • Encloses custom view content in a customizable rounded rectangle background.
  • Provides an internal content view adjusted by the insets, making it much easier to insert and configure the frames of view content.
  • Internally manages the layering of the content and the background views to ensure that off-screen render passes don't occur as much as possible, ensuring best possible performance.
  • Provides convenience properties and methods for configuring view content to have adjusted corner radius values that align with the outer radius.
  • The rounded rectangle background view can potentially be made translucent using UIVisualEffectView.

System Requirements

iOS 13.0 and above.

Installation

As a CocoaPods Dependency

Add the following to your Podfile:

pod 'TOBorderView'

Swift Package Manager

Will be coming as soon as I get the time! If you can't wait, please consider filing a PR.

Manual Installation

Copy the folder TOBorderView to your Xcode project.

TOBorderView is an Objective-C project, but it has been written to work properly in Swift as well. If you are using it in a Swift project, don't forget to include it in your Objective-C bridging header.

Examples

// Make an image view as some kind of content
UIImageView *imageView = [[UIImageView alloc] initWithFrame:(CGRect){0,0,100,135}];

// Make a border view
TOBorderView *borderView = [[TOBorderView alloc] init];

// Set the insets to be really tight around the imaga
[borderView setAllContentInsets: 10.0f];

// Add the image view to the border view
[borderView addSubview: imageView];

// Configure the image view to have matching corner radius
[borderView applyContentCornerRadiusToView: imageView];

// Size the border view to wrap around the image view
[borderView sizeToFit];

Credits

TOBorderView was originally created by Tim Oliver as a component for iComics 2, an upcoming comic reader app for iOS.

iOS Device mockups used in the screenshot created by Pixeden.

License

TOBorderView is licensed under the MIT License, please see the LICENSE file.

You might also like...
A way to quickly add a notification badge icon to any view. Make any view of a full-fledged animated notification center.
A way to quickly add a notification badge icon to any view. Make any view of a full-fledged animated notification center.

BadgeHub A way to quickly add a notification badge icon to any view. Demo/Example For demo: $ pod try BadgeHub To run the example project, clone the r

Confetti View lets you create a magnificent confetti view in your app
Confetti View lets you create a magnificent confetti view in your app

ConfettiView Confetti View lets you create a magnificent confetti view in your app. This was inspired by House Party app's login screen. Written in Sw

A custom stretchable header view for UIScrollView or any its subclasses with UIActivityIndicatorView and iPhone X safe area support for content reloading. Built for iOS 10 and later.

Arale A custom stretchable header view for UIScrollView or any its subclasses with UIActivityIndicatorView support for reloading your content. Built f

Play BreakOut while loading - A playable pull to refresh view using SpriteKit
Play BreakOut while loading - A playable pull to refresh view using SpriteKit

BreakOutToRefresh Play BreakOut while loading - A playable pull to refresh view using SpriteKit BreakOutToRefresh uses SpriteKit to add a playable min

A simple, customizable view for efficiently collecting country information in iOS apps.
A simple, customizable view for efficiently collecting country information in iOS apps.

CountryPickerView CountryPickerView is a simple, customizable view for selecting countries in iOS apps. You can clone/download the repository and run

Elissa displays a notification on top of a UITabBarItem or any UIView anchor view to reveal additional information.
Elissa displays a notification on top of a UITabBarItem or any UIView anchor view to reveal additional information.

Elissa Attach a local notification to any UIView to reveal additional user guidance. Usage Example Per default, Elissa will try to align to the center

Cool Animated music indicator view written in Swift
Cool Animated music indicator view written in Swift

Cool Animated music indicator view written in Swift. ESTMusicIndicator is an implementation of NAKPlaybackIndicatorView in Swift for iOS 8. 本人著作的书籍《La

A child view controller framework that makes setting up your parent controllers as easy as pie.
A child view controller framework that makes setting up your parent controllers as easy as pie.

Description Family is a child view controller framework that makes setting up your parent controllers as easy as pie. With a simple yet powerful publi

An easy to use FAQ view for iOS written in Swift
An easy to use FAQ view for iOS written in Swift

FAQView An easy to use FAQ view for iOS written in Swift. This view is a subclass of UIView. Setup with CocoaPods If you are using CocoaPods add this

Comments
  • Add compatibility for iOS 9

    Add compatibility for iOS 9

    Even though I'm not going to use it in iOS 9, in order to integrate this library into iComics via CocoaPods, I need to set its version compatibility as such.

    This PR updates the API and specs for support with iOS 9.

    opened by TimOliver 0
Owner
Tim Oliver
Gamer. Developer. Geek. Senior Software Engineer at @Drivemode (prev. @Realm). Lover of writing iOS code and singer of bad karaoke. 日本語もオッケ〜
Tim Oliver
A container view that responds to scrolling of UIScrollView

FlexibleHeader A container view that responds to scrolling of UIScrollView. normal threshold FlexibleHeaderExecutantType Getting Started Progressive I

DongHee Kang 69 May 2, 2022
Creating a blurred window background in Mac Catalyst

TransparentChrome In response to a developer question, I looked for the easiest way to provide a translucent full-window chrome with a blurred backgro

Steven Troughton-Smith 37 Dec 2, 2022
📹 Framework to Play a Video in the Background of any UIView

SwiftVideoBackground is an easy to use Swift framework that provides the ability to play a video on any UIView. This provides a beautiful UI for login

Wilson Ding 334 Jan 7, 2023
Flexible Mustache templates for Swift

GRMustache.swift Mustache templates for Swift Latest release: October 23, 2016 • version 2.0.0 • CHANGELOG Requirements: iOS 8.0+ / OSX 10.9+ / tvOS 9

Gwendal Roué 569 Dec 27, 2022
UIPheonix is a super easy, flexible, dynamic and highly scalable UI framework + concept for building reusable component/control-driven apps for macOS, iOS and tvOS

UIPheonix is a super easy, flexible, dynamic and highly scalable UI framework + concept for building reusable component/control-driven apps for macOS, iOS and tvOS

Mohsan Khan 29 Sep 9, 2022
Flexible UI Framework Designed for Swift

Overlay Overlay is a very flexible UI framework designed for Swift. Note: Overlay is still under development and many things are subject to change. Fe

TintPoint 52 Sep 4, 2022
TSnackBarView is a simple and flexible UI component fully written in Swift

TSnackBarView is a simple and flexible UI component fully written in Swift. TSnackBarView helps you to show snackbar easily with 3 styles: normal, successful and error

Nguyen Duc Thinh 3 Aug 22, 2022
TDetailBoxView is a simple and flexible UI component fully written in Swift

TDetailBoxView is a simple and flexible UI component fully written in Swift. TDetailBoxView is developed to help users quickly display the detail screen without having to develop from scratch.

Nguyen Duc Thinh 2 Aug 18, 2022
TSwitchLabel is a simple and flexible UI component fully written in Swift.

TSwitchLabel is a simple and flexible UI component fully written in Swift. TSwitchLabel is developed for you to easily use when you need to design a UI with Label and Switch in the fastest way without having to spend time on develop from scratch.

Nguyen Duc Thinh 2 Aug 18, 2022