All Projects → MarioIannotta → Mialertcontroller

MarioIannotta / Mialertcontroller

A simple fully customizable alert controller

Programming Languages

swift
15916 projects

Labels

Projects that are alternatives of or similar to Mialertcontroller

Fwpopupview
弹窗控件:支持AlertView、Sheet、自定义视图的PopupView。AlertView中可以嵌套自定义视图,各组件的显示隐藏可配置;Sheet仿微信样式;同时提供自定义弹出。更多配置请参考”可设置参数“,提供OC使用Demo。
Stars: ✭ 361 (+581.13%)
Mutual labels:  pod, popup
Hhcustomcorner
Awesome library to customize corners of UIView and UIButton. Now you can customize each corner differently
Stars: ✭ 36 (-32.08%)
Mutual labels:  pod
Gqanimation
几种常见的动画,如晴天,雨天,多云,雷阵雨,二维码扫描,脉冲等
Stars: ✭ 19 (-64.15%)
Mutual labels:  pod
Arek
AREK is a clean and easy way to request any kind of iOS permission (with some nifty features 🤖)
Stars: ✭ 947 (+1686.79%)
Mutual labels:  popup
Paypal Checkout Components
Javascript Integration for PayPal Button and PayPal Checkout
Stars: ✭ 938 (+1669.81%)
Mutual labels:  popup
Ajmessage
Simple popup message
Stars: ✭ 30 (-43.4%)
Mutual labels:  popup
Holler Box
Smart, stylish WordPress popup plugin
Stars: ✭ 16 (-69.81%)
Mutual labels:  popup
Kubernetes
K8S Kubeadm和二进制部署高可用集群
Stars: ✭ 49 (-7.55%)
Mutual labels:  pod
Fepopupmenucontroller
A simple, elegant pop-up menu view
Stars: ✭ 32 (-39.62%)
Mutual labels:  popup
Highlighter
🖍 Highlight whatever you want!
Stars: ✭ 909 (+1615.09%)
Mutual labels:  pod
Openshift Psap
Example roles and yaml files for performance-sensitive applications running on OpenShift
Stars: ✭ 20 (-62.26%)
Mutual labels:  pod
Openebs
Leading Open Source Container Attached Storage, built using Cloud Native Architecture, simplifies running Stateful Applications on Kubernetes.
Stars: ✭ 7,277 (+13630.19%)
Mutual labels:  pod
Popup Bridge Android
PopupBridge allows WebViews to open popup windows in a browser and send data back to the WebView
Stars: ✭ 31 (-41.51%)
Mutual labels:  popup
Bitcoin Donate
Add simple donate buttons to any website
Stars: ✭ 24 (-54.72%)
Mutual labels:  popup
Wbounce
wBounce improves bounce rate to boost conversions and sales. The free alternative to Bounce Exchange for WordPress. WordPress plugin.
Stars: ✭ 38 (-28.3%)
Mutual labels:  popup
Data Collection Dotnet
Data collection application built using the .NET Runtime SDK.
Stars: ✭ 17 (-67.92%)
Mutual labels:  popup
Ios Imagezoomviewer
ImageZoomViewer is a simple to use Objective C framework that allows the capability of viewing images with zoom-in zoom-out functionality.
Stars: ✭ 14 (-73.58%)
Mutual labels:  pod
Amgcalendarmanager
EventKit helper for Swift 3
Stars: ✭ 29 (-45.28%)
Mutual labels:  pod
Cdalertview
Highly customizable alertview and alert/notification/success/error/alarm popup written in Swift
Stars: ✭ 1,056 (+1892.45%)
Mutual labels:  popup
Spalert
Native alert from Apple Music & Feedback. Contains Done, Heart & Message and other presets.
Stars: ✭ 1,014 (+1813.21%)
Mutual labels:  popup

MIAlertController

A simple fully customizable alert controller

Platform Swift 2.2 Swift 3 Cocoapods Compatible

Setup

  • Add pod 'MIAlertController', '~> 1.3' to your Podfile if you're using Swift 3 or copy the "MIAlertController" folder into your project from the master branch
  • Add pod 'MIAlertController', '~> 1.1' to your Podfile if you're using Swift 2.2 7 or copy the "MIAlertController" folder into your project from the "swift2.2" branch
  • Create a new instance with just a line of code
MIAlertController(

  title: "Your alert title",
  message: "Your alert description",
  buttons: [
    MIAlertController.Button(title: "Button one", action: {
      print("button one tapped")
    }),
    MIAlertController.Button(title: "Button two", action: {
      print("button two tapped")
    })
  ]

).presentOn(self)

Customization

  • You can customize the alert's behavior and UI by creating a new instance of the struct MIAlertController.Config and changing it's property as you like
    • config.dismissOnTouchOutsideEnabled -> It allows the user to dismiss the alert by tapping anywhere outside it
    • config.backgroundColor -> Overlay layer background
    • config.alertViewBackgroundColor -> Alert background
    • config.alertViewCornerRadius -> Alert corner radius
    • config.alertMarginSize -> The max margins between the alert and the screen
    • config.separatorColor -> The color of separator between the buttons
    • config.alertViewMaxSize -> The max size of the alert
    • config.titleLabelFont -> the font of the title
    • config.titleLabelTextColor -> the color of the title
    • config.titleLabelTextAlignment -> the text alignment of the title
    • config.messageLabelFont -> the font of the message
    • config.messageLabelTextColor -> the color of the message
    • config.messageLabelTextAlignment -> the text alignment of the message
    • config.messageVerticalSpaceFromTitle -> the space from title of the message
    • config.buttonBackgroundView -> the background color of the view who contains the buttons
    • config.firstButtonRatio -> the ratio between the width of the buttons container and the width of the first button; Only available with two buttons
  • There are three type of buttons (.Default, .Destructive, .Cancel) with different UI but you can create a new type by using the struct MIAlertController.Button.Config
    • config.font -> the font of the button
    • config.textColor -> the color of the button's text
    • config.textAlignment -> the alignment of the button's text
    • config.backgroundColor -> the background color of the button
    • config.buttonHeight -> the height of the button
    • config.contentEdgeOffset -> the edge offset of the button

Example

// Alert UI and behavior
var googlishAlertControllerConfig = MIAlertController.Config()

googlishAlertControllerConfig.firstButtonRatio = 0.8
googlishAlertControllerConfig.alertViewCornerRadius = 1
googlishAlertControllerConfig.messageLabelTextColor = UIColor(white: 0.45, alpha: 1)

googlishAlertControllerConfig.messageVerticalSpaceFromTitle = 25
googlishAlertControllerConfig.messageLabelFont = UIFont.systemFontOfSize(17)

googlishAlertControllerConfig.alertMarginSize = CGSize(width: 10, height: 10)
googlishAlertControllerConfig.alertViewMaxSize = CGSize(width: UIScreen.mainScreen().bounds.size.width - 80, height: 340)

googlishAlertControllerConfig.titleLabelTextAlignment = NSTextAlignment.Left
googlishAlertControllerConfig.messageLabelTextAlignment = NSTextAlignment.Left

// Buttons UI
var googlishAlertControllerLeftButtonConfig = MIAlertController.Button.Config()

googlishAlertControllerLeftButtonConfig.textColor = UIColor(red: 19/255.0, green: 152/255.0, blue: 138/255.0, alpha: 1)
googlishAlertControllerLeftButtonConfig.textAlignment = .Right
googlishAlertControllerLeftButtonConfig.font = UIFont.boldSystemFontOfSize(15)

var googlishAlertControllerRightButtonConfig = MIAlertController.Button.Config()

googlishAlertControllerRightButtonConfig.textColor = UIColor(red: 19/255.0, green: 152/255.0, blue: 138/255.0, alpha: 1)
googlishAlertControllerRightButtonConfig.font = UIFont.boldSystemFontOfSize(15)

let alertController = MIAlertController(
  title: "I'm a googlish alert!",
  message: "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris",
  config: googlishAlertControllerConfig
)

alertController.addButton(
  MIAlertController.Button(title: "COOL", config: googlishAlertControllerLeftButtonConfig, action: {
    print("cool tapped")
  })
)

alertController.addButton(
  MIAlertController.Button(title: "OK", config: googlishAlertControllerRightButtonConfig, action: {
    print("ok tapped")
  })
)

alertController.presentOn(self)

#Demo In this repository you can also find a demo.

Info

If you like this git you can follow me here or on twitter :) @MarioIannotta

Cheers from Italy!

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