All Projects → MxABC → LBXAlertAction

MxABC / LBXAlertAction

Licence: MIT license
UIAlertView、UIActionSheet、UIAlertController封装,根据不同iOS版本选择对应的方法

Programming Languages

objective c
16641 projects - #2 most used programming language
swift
15916 projects
ruby
36898 projects - #4 most used programming language

Projects that are alternatives of or similar to LBXAlertAction

JHTAlertController
A custom iOS alert that replaces the stock UIAlertController. Easily style the alert to match your app. Written in Swift for iOS.
Stars: ✭ 58 (+1.75%)
Mutual labels:  uialertview, uialertcontroller, alertcontroller
MMActionSheet
An actionSheet view implement with pure swift
Stars: ✭ 25 (-56.14%)
Mutual labels:  uiactionsheet
SheetyColors
An action sheet styled color picker for iOS.
Stars: ✭ 101 (+77.19%)
Mutual labels:  uialertcontroller
UIMediaAlertController
UIAlertController extension for selecting images.
Stars: ✭ 19 (-66.67%)
Mutual labels:  uialertcontroller
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 (-64.91%)
Mutual labels:  alertcontroller
KeyCommandAlertController
UIAlertController wrapper to add keyboard shortcuts easily
Stars: ✭ 16 (-71.93%)
Mutual labels:  uialertcontroller
KOAlertController
KOAlertController custom alert controller, alternative default UIAlertController
Stars: ✭ 36 (-36.84%)
Mutual labels:  uialertcontroller
STAlertView
简易AlertView,添加动画效果
Stars: ✭ 44 (-22.81%)
Mutual labels:  uialertview
Swiftentrykit
SwiftEntryKit is a presentation library for iOS. It can be used to easily display overlays within your iOS apps.
Stars: ✭ 5,706 (+9910.53%)
Mutual labels:  uialertcontroller
Alerts And Pickers
Advanced usage of UIAlertController and pickers based on it: Telegram, Contacts, Location, PhotoLibrary, Country, Phone Code, Currency, Date...
Stars: ✭ 5,267 (+9140.35%)
Mutual labels:  uialertcontroller
Sclalertview
Beautiful animated Alert View. Written in Objective-C
Stars: ✭ 3,426 (+5910.53%)
Mutual labels:  uialertcontroller
Xlactioncontroller
Fully customizable and extensible action sheet controller written in Swift
Stars: ✭ 3,228 (+5563.16%)
Mutual labels:  uialertcontroller

UIAlertView、UIActionSheet、UIAlertController封装

cocoapods安装

oc版本
platform :ios, '6.0'
pod 'LBXAlertAction'
swift版本
platform :ios, '8.0'
pod 'AlertAction'

手动导入:

将LBXAlertAction文件夹中的所有文件拽入项目中 导入主头文件:#import "LBXAlertAction.h"

swift:将AlertAction文件夹内所有文件拖入项目中即可

使用说明

Alert形式示例

//oc版本
__weak __typeof(self) weakSelf = self;
[LBXAlertAction showAlertWithTitle:@"标题"
                               msg:@"提示消息内容"
                  buttonsStatement:@[@"取消",@"确认1",@"确认2",@"确认3",@"确认4",@"确认5",@"确认6"]
                       chooseBlock:^(NSInteger buttonIdx) {

                          NSArray* array = @[@"取消",@"确认1",@"确认2",@"确认3",@"确认4",@"确认5",@"确认6"];

                          //按钮按顺序输出
                          NSLog(@"u choose:%@",array[buttonIdx]);
                         [weakSelf dosomething];
                          }];
//swift版本
        let items = ["cancel","ok1","ok2"];
        
        AlertAction.showAlert(title: "title", message: "message", btnStatements:items ) { (buttonIndex) in
            
            
            let items = ["cancel","ok1","ok2"];
            
            print(buttonIndex)
            
            print(items[buttonIndex])
          
        }

Sheet形式示例

__weak __typeof(self) weakSelf = self;
[LBXAlertAction showActionSheetWithTitle:@"标题"
                                 message:@"ios8系统之后才会显示本消息内容"
                       cancelButtonTitle:@"取消"
                  destructiveButtonTitle:@"destruct"
                        otherButtonTitle:@[@"items1",@"items2",@"items3"]
                             chooseBlock:^(NSInteger buttonIdx) {

                            //取消为0,destructiveButtonTitle从1开始,
                            //如果destructiveButtonTitle输入为nil,则otherButtonTitle从1开始,否则从2开始
                            NSLog(@"%ld",buttonIdx);
                           [weakSelf dosomething];
                           }];
//swift版本
        let destrucitve:String? = "destructive"
        
//        let destrucitve:String? = nil
        
        AlertAction.showSheet(title: "title", message: "ios8之后才会显示本条信息",  destructiveButtonTitle: destrucitve,cancelButtonTitle: "cancel", otherButtonTitles: ["other1","other2"]) { (buttonIdx, itemTitle) in
            
            /*
             经测试
             buttonIdx:  destructiveButtonTitle 为0, cancelButtonTitle 为1,otherButtonTitles按顺序增加
             如果destructiveButtonTitle 传入值为nil,那么 cancelButtonTitle 为0,otherButtonTitles按顺序增加
             
             或者按照itemTitle来判断用户点击那个按钮更稳妥
             */
            
            print(buttonIdx)
            print(itemTitle)
        }

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