All Projects → sberrevoets → Sdcalertview

sberrevoets / Sdcalertview

Licence: mit
The little alert that could

Programming Languages

swift
15916 projects

Projects that are alternatives of or similar to Sdcalertview

Alertift
Swifty, modern UIAlertController wrapper.
Stars: ✭ 242 (-86.31%)
Mutual labels:  actionsheet, alert
iakit
无依赖 mini 组件库,只封装了 alert, toast, loading, actionSheet 等使用频率较高的组件。适用于类似 H5 活动页的简单移动端项目,不必为了使用这些组件而引入一个大而全的 UI 库和框架。
Stars: ✭ 38 (-97.85%)
Mutual labels:  alert, actionsheet
AlertKit
🚨 SwiftUI alerts (and action sheets) done right
Stars: ✭ 60 (-96.61%)
Mutual labels:  alert, actionsheet
ImageActionSheet
iOS Native style action sheet like in Whatsapp with the option of showing icons. It is a complete implementation and does not use any private api of UIKit.
Stars: ✭ 20 (-98.87%)
Mutual labels:  alert, actionsheet
Easyshowview
一款非常简单的展示工具。提示框,加载框,空白页提示,alert弹出框。一行代码搞定所有操作。
Stars: ✭ 447 (-74.72%)
Mutual labels:  actionsheet, alert
Overlaycontroller
OverlayController easily pop your custom view and provide optional transition animation. written in swift 5.0
Stars: ✭ 94 (-94.68%)
Mutual labels:  actionsheet, alert
vue2-dialog
A mobile Vue plugin for VueDialog
Stars: ✭ 21 (-98.81%)
Mutual labels:  alert, actionsheet
Tfpopup
🚀🚀🚀TFPopup不生产弹框,它只是弹框的弹出工🚀🚀🚀默认支持多种动画方式一行调用,支持完全自定义动画.
Stars: ✭ 182 (-89.71%)
Mutual labels:  actionsheet, alert
Zhpopupcontroller
Help you pop up custom views easily. and support pop-up animation, layout position, mask effect and gesture interaction etc.
Stars: ✭ 1,481 (-16.23%)
Mutual labels:  actionsheet, alert
Uiwidget
一个集成TabLayout、UIAlertDialog、UIActionSheetDialog、UIProgressDialog、TitleBarView(自带沉浸式标题栏)、CollapsingTitleBarLayout、RadiusView(圆角及状态背景设置View解放shape文件)、KeyboardHelper(软键盘控制及遮挡控制类)、StatusViewHelper(状态栏沉浸帮助类)、NavigationViewHelper(导航栏沉浸式帮助类)、AlphaViewHelper(View透明度控制帮助类) 等项目常用UI库
Stars: ✭ 400 (-77.38%)
Mutual labels:  actionsheet, alert
Tltransitions
快速实现控制器的转场和View的快速popover显示,并支持自定义动画、手势退场
Stars: ✭ 296 (-83.26%)
Mutual labels:  actionsheet, alert
Lcactionsheet
一款简约而不失强大的 ActionSheet,微博、微信和 QQ 都采用了极其类似的样式,完全支持 Swift。
Stars: ✭ 809 (-54.24%)
Mutual labels:  actionsheet, alert
Swiftentrykit
SwiftEntryKit is a presentation library for iOS. It can be used to easily display overlays within your iOS apps.
Stars: ✭ 5,706 (+222.74%)
Mutual labels:  actionsheet, alert
Leealert
优雅的可自定义 Alert ActionSheet
Stars: ✭ 1,097 (-37.95%)
Mutual labels:  actionsheet, alert
Customalertviewdialogue
Custom AlertView Dialogue is the world's most advanced alert view library. Custom AlertView Dialogue includes simple message popups, confirmation alerts, selector popups, action sheet bottom menus, and input/feedback contact forms.
Stars: ✭ 100 (-94.34%)
Mutual labels:  alert
Jxpopupview
一个轻量级的自定义视图弹出框架
Stars: ✭ 117 (-93.38%)
Mutual labels:  alert
Coinwink
Crypto Alerts, Watchlist and Portfolio Tracking App
Stars: ✭ 95 (-94.63%)
Mutual labels:  alert
React Native Dropdownalert
A simple alert to notify users about new chat messages, something went wrong or everything is ok.
Stars: ✭ 1,628 (-7.92%)
Mutual labels:  alert
Hibiscus.js
Native Angular directives for Bootstrap4
Stars: ✭ 115 (-93.5%)
Mutual labels:  alert
Vue Simple Alert
Simple alert(), confirm(), prompt() for Vue.js
Stars: ✭ 93 (-94.74%)
Mutual labels:  alert

SDCAlertView

SDCAlertView started out as an alert that looked identical to UIAlertView, but had support for a custom content view. With the introduction of UIAlertController in iOS 8, the project was updated to the more modern API that UIAlertController brought.

Features

  • Most UIAlertController functionality
  • Custom content views
  • Preventing controllers from dismissing when the user taps a button
  • Easy presentation/dismissal
  • Attributed title label, message label, and buttons
  • Appearance customization
  • Usable from Swift and Objective-C
  • Understandable button placement
  • UI tests
  • Custom alert behavior
  • CocoaPods/Carthage/Swift Package Manager support
  • Easy queueing of alerts

Requirements

  • Swift 5.0
  • iOS 9 or higher

Installation

CocoaPods

To install SDCAlertView using CocoaPods, integrate it in your existing Podfile, or create a new Podfile:

platform :ios, '9.0'
use_frameworks!

target 'MyApp' do
  pod 'SDCAlertView'
end

Then run pod install.

Carthage

To install with Carthage, add the following line to your Cartfile:

github "sberrevoets/SDCAlertView"

Run carthage update and drag SDCAlertView.framework in the Build folder into your project.

Swift Package Manager

To install with Swift Package Manager, add this package to your project’s 'Swift Packages' section. Or add the following line to your Package.swift:

 .package(url: "https://github.com/sberrevoets/SDCAlertView.git", from: "12.0.1")

Alerts vs. Action Sheets

SDCAlertController supports the presentation of action sheets, but there are some limitations and things to keep in mind when using action sheets:

  • It does not properly adapt on iPad. This is because iOS doesn't support UIModalPresentationStyle.Custom for adaptive presentations (such as when presenting an action sheet from a bar button item).
  • The new AlertBehaviors is, due to limitations in the Swift/Objective-C interop, not available when using SDCAlertController from Swift. This affects AlertControllerStyle.Alert as well.
  • When adding subviews to the custom content view, that view will replace the title and message labels.

Usage

SDCAlertView is written in Swift, but can be used in both Swift and Objective-C. Corresponding types in Objective-C have the same name they do in Swift, but with an SDC prefix.

Basic

let alert = AlertController(title: "Title", message: "This is a message", preferredStyle: .alert)
alert.addAction(AlertAction(title: "Cancel", style: .normal))
alert.addAction(AlertAction(title: "OK", style: .preferred))
alert.present()

// or use the convenience methods:

AlertController.alert(withTitle: "Title", message: "This is a message", actionTitle: "OK")
AlertController.sheet(withTitle: "Action sheet title", "Action sheet message", actions: ["OK", "Cancel"])

Custom Content Views

let spinner = UIActivityIndicatorView(activityIndicatorStyle: .gray)
spinner.translatesAutoresizingMaskIntoConstraints = false
spinner.startAnimating()

let alert = AlertController(title: "Title", message: "Please wait...")
alert.contentView.addSubview(spinner)

spinner.centerXAnchor.constraint(equalTo: alert.contentView.centerXAnchor).isActive = true
spinner.topAnchor.constraint(equalTo: alert.contentView.topAnchor).isActive = true
spinner.bottomAnchor.constraint(equalTo: alert.contentView.bottomAnchor).isActive = true

alert.present()

Dismissal Prevention

let alert = AlertController(title: "Title", message: "This is a message")
alert.addAction(AlertAction(title: "Dismiss", style: .preferred))
alert.addAction(AlertAction(title: "Don't dismiss", style: .normal))
alert.shouldDismissHandler = { $0.title == "Dismiss" }
alert.present()

Styling and Appearance

SDCAlertController is a normal view controller, so applying a tintColor to its view will color the buttons and any subviews you add to the contentView.

If you are looking for more customizations, create a subclass of AlertVisualStyle and use visualStyle on the AlertController instance. You can also create an instance of AlertVisualStyle and overwrite the attributes you need (this is mainly intended to be used from Objective-C). Note that after an alert has been presented, changing any of these settings is ignored.

License

SDCAlertView is distributed 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].