├── .gitignore ├── .travis.yml ├── LEAlertController.podspec ├── LEAlertController ├── LEAlertController.h ├── LEAlertController.m ├── UIActionSheet+LEBlocks.h ├── UIActionSheet+LEBlocks.m ├── UIAlertView+LEBlocks.h └── UIAlertView+LEBlocks.m ├── LEAlertControllerDemo.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ └── contents.xcworkspacedata └── xcshareddata │ └── xcschemes │ └── LEAlertControllerDemo.xcscheme ├── LEAlertControllerDemo ├── AppDelegate.h ├── AppDelegate.m ├── Base.lproj │ ├── LaunchScreen.xib │ └── Main.storyboard ├── Images.xcassets │ └── AppIcon.appiconset │ │ └── Contents.json ├── Info.plist ├── ViewController.h ├── ViewController.m └── main.m ├── LICENSE ├── README.md └── Screenshots ├── actionsheet.png └── alert.png /.gitignore: -------------------------------------------------------------------------------- 1 | # Xcode 2 | # 3 | build/ 4 | *.pbxuser 5 | !default.pbxuser 6 | *.mode1v3 7 | !default.mode1v3 8 | *.mode2v3 9 | !default.mode2v3 10 | *.perspectivev3 11 | !default.perspectivev3 12 | xcuserdata 13 | *.xccheckout 14 | *.moved-aside 15 | DerivedData 16 | *.hmap 17 | *.ipa 18 | *.xcuserstate 19 | 20 | # CocoaPods 21 | # 22 | # We recommend against adding the Pods directory to your .gitignore. However 23 | # you should judge for yourself, the pros and cons are mentioned at: 24 | # http://guides.cocoapods.org/using/using-cocoapods.html#should-i-ignore-the-pods-directory-in-source-control 25 | # 26 | # Pods/ 27 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: objective-c 2 | script: xctool -project LEAlertControllerDemo.xcodeproj -scheme LEAlertControllerDemo -sdk iphonesimulator8.1 -------------------------------------------------------------------------------- /LEAlertController.podspec: -------------------------------------------------------------------------------- 1 | # 2 | # Be sure to run `pod lib lint LEAlertController.podspec' to ensure this is a 3 | # valid spec and remove all comments before submitting the spec. 4 | # 5 | # Any lines starting with a # are optional, but encouraged 6 | # 7 | # To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html 8 | # 9 | 10 | Pod::Spec.new do |s| 11 | s.name = "LEAlertController" 12 | s.version = "0.1.7" 13 | s.summary = "UIAlertController with iOS 7 support" 14 | s.description = "LEAlertController is a UIAlertController extension for iOS 7 support" 15 | s.homepage = "https://github.com/efremidze/LEAlertController" 16 | s.screenshots = "https://github.com/efremidze/LEAlertController/raw/master/Screenshots/alert.png", "https://github.com/efremidze/LEAlertController/raw/master/Screenshots/actionsheet.png" 17 | s.license = 'MIT' 18 | s.author = { "Lasha Efremidze" => "efremidzel@hotmail.com" } 19 | s.source = { :git => "https://github.com/efremidze/LEAlertController.git", :tag => s.version.to_s } 20 | s.social_media_url = 'http://linkedin.com/in/efremidze' 21 | s.platform = :ios, '7.0' 22 | s.requires_arc = true 23 | s.source_files = 'LEAlertController/*' 24 | end 25 | -------------------------------------------------------------------------------- /LEAlertController/LEAlertController.h: -------------------------------------------------------------------------------- 1 | // 2 | // LEAlertController.h 3 | // LEAlertController 4 | // 5 | // Created by Lasha Efremidze on 3/25/15. 6 | // Copyright (c) 2015 Lasha Efremidze. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | typedef NS_ENUM(NSInteger, LEAlertActionStyle) { 12 | LEAlertActionStyleDefault = 0, 13 | LEAlertActionStyleCancel, 14 | LEAlertActionStyleDestructive 15 | }; 16 | 17 | typedef NS_ENUM(NSInteger, LEAlertControllerStyle) { 18 | LEAlertControllerStyleActionSheet = 0, 19 | LEAlertControllerStyleAlert 20 | }; 21 | 22 | @class LEAlertAction; 23 | 24 | typedef void (^LEAlertActionHandler)(LEAlertAction *action); 25 | 26 | typedef void (^LEAlertControllerCompletionBlock)(id sender, NSInteger buttonIndex); 27 | 28 | #pragma mark - LEAlertAction 29 | 30 | @interface LEAlertAction : NSObject 31 | 32 | + (instancetype)actionWithTitle:(NSString *)title style:(LEAlertActionStyle)style handler:(LEAlertActionHandler)handler; 33 | 34 | @property (nonatomic, readonly) NSString *title; 35 | @property (nonatomic, readonly) LEAlertActionStyle style; 36 | @property (nonatomic, getter=isEnabled) BOOL enabled; 37 | 38 | @end 39 | 40 | #pragma mark - LEAlertController 41 | 42 | @interface LEAlertController : NSObject 43 | 44 | + (instancetype)alertControllerWithTitle:(NSString *)title message:(NSString *)message preferredStyle:(LEAlertControllerStyle)preferredStyle; 45 | 46 | - (void)addAction:(LEAlertAction *)action; 47 | @property (nonatomic, readonly) NSArray *actions; 48 | - (void)addTextFieldWithConfigurationHandler:(void (^)(UITextField *textField))configurationHandler; 49 | @property (nonatomic, readonly) NSArray *textFields; 50 | 51 | @property (nonatomic, copy) NSString *title; 52 | @property (nonatomic, copy) NSString *message; 53 | 54 | @property (nonatomic, readonly) LEAlertControllerStyle preferredStyle; 55 | 56 | @end 57 | 58 | #pragma mark - UIViewController (LEAlertController) 59 | 60 | @interface UIViewController (LEAlertController) 61 | 62 | - (void)presentAlertController:(LEAlertController *)alertController animated:(BOOL)animated completion:(void (^)(void))completion; 63 | 64 | @end 65 | -------------------------------------------------------------------------------- /LEAlertController/LEAlertController.m: -------------------------------------------------------------------------------- 1 | // 2 | // LEAlertController.m 3 | // LEAlertController 4 | // 5 | // Created by Lasha Efremidze on 3/25/15. 6 | // Copyright (c) 2015 Lasha Efremidze. All rights reserved. 7 | // 8 | 9 | #import "LEAlertController.h" 10 | 11 | #import "UIAlertView+LEBlocks.h" 12 | #import "UIActionSheet+LEBlocks.h" 13 | 14 | #pragma mark - LEAlertAction 15 | 16 | @interface LEAlertAction () 17 | 18 | @property (nonatomic, copy) LEAlertActionHandler handler; 19 | 20 | @end 21 | 22 | @implementation LEAlertAction 23 | 24 | + (instancetype)actionWithTitle:(NSString *)title style:(LEAlertActionStyle)style handler:(LEAlertActionHandler)handler; 25 | { 26 | return [[self alloc] initWithTitle:title style:style handler:handler]; 27 | } 28 | 29 | - (instancetype)initWithTitle:(NSString *)title style:(LEAlertActionStyle)style handler:(LEAlertActionHandler)handler; 30 | { 31 | if (self = [super init]) { 32 | _title = title; 33 | _style = style; 34 | _handler = handler; 35 | } 36 | return self; 37 | } 38 | 39 | #pragma mark - NSCopying 40 | 41 | - (instancetype)copyWithZone:(NSZone *)zone 42 | { 43 | return [[LEAlertAction allocWithZone:zone] initWithTitle:self.title.copy style:self.style handler:self.handler]; 44 | } 45 | 46 | @end 47 | 48 | #pragma mark - LEAlertController 49 | 50 | @interface LEAlertController () 51 | 52 | @property (nonatomic, strong) NSMutableArray *mutableActions; 53 | @property (nonatomic, strong) NSMutableArray *mutableTextFields; 54 | 55 | @property (nonatomic, strong) NSMutableDictionary *configurationHandlers; 56 | 57 | @end 58 | 59 | @implementation LEAlertController 60 | 61 | + (instancetype)alertControllerWithTitle:(NSString *)title message:(NSString *)message preferredStyle:(LEAlertControllerStyle)preferredStyle; 62 | { 63 | return [[self alloc] initWithTitle:title message:message preferredStyle:preferredStyle]; 64 | } 65 | 66 | - (instancetype)initWithTitle:(NSString *)title message:(NSString *)message preferredStyle:(LEAlertControllerStyle)preferredStyle; 67 | { 68 | if (self = [super init]) { 69 | _title = title; 70 | _message = message; 71 | _preferredStyle = preferredStyle; 72 | 73 | _mutableActions = [NSMutableArray array]; 74 | _mutableTextFields = [NSMutableArray array]; 75 | 76 | _configurationHandlers = [NSMutableDictionary dictionary]; 77 | } 78 | return self; 79 | } 80 | 81 | #pragma mark - 82 | 83 | - (NSArray *)actions 84 | { 85 | return self.mutableActions.copy; 86 | } 87 | 88 | - (NSArray *)textFields 89 | { 90 | return self.mutableTextFields.copy; 91 | } 92 | 93 | #pragma mark - 94 | 95 | - (void)addAction:(LEAlertAction *)action; 96 | { 97 | [self.mutableActions addObject:action]; 98 | } 99 | 100 | - (void)addTextFieldWithConfigurationHandler:(void (^)(UITextField *textField))configurationHandler; 101 | { 102 | UITextField *textField = [UITextField new]; 103 | if (configurationHandler) 104 | configurationHandler(textField); 105 | [self.mutableTextFields addObject:textField]; 106 | 107 | if (configurationHandler) 108 | self.configurationHandlers[[NSValue valueWithNonretainedObject:textField]] = configurationHandler; 109 | } 110 | 111 | #pragma mark - NSCopying 112 | 113 | - (instancetype)copyWithZone:(NSZone *)zone 114 | { 115 | LEAlertController *alertController = [[LEAlertController allocWithZone:zone] initWithTitle:self.title.copy message:self.message.copy preferredStyle:self.preferredStyle]; 116 | 117 | for (LEAlertAction *action in self.actions) { 118 | [alertController addAction:action.copy]; 119 | } 120 | 121 | for (UITextField *textField in self.textFields) { 122 | [alertController addTextFieldWithConfigurationHandler:self.configurationHandlers[[NSValue valueWithNonretainedObject:textField]]]; 123 | } 124 | 125 | return alertController; 126 | } 127 | 128 | @end 129 | 130 | #pragma mark - UIViewController (LEAlertController) 131 | 132 | @implementation UIViewController (LEAlertController) 133 | 134 | - (void)presentAlertController:(LEAlertController *)alertController animated:(BOOL)animated completion:(void (^)(void))completion; 135 | { 136 | if ([UIAlertController class]) { 137 | UIAlertController *newAlertController = [UIAlertController alertControllerWithTitle:alertController.title message:alertController.message preferredStyle:(UIAlertControllerStyle)alertController.preferredStyle]; 138 | 139 | for (LEAlertAction *action in alertController.actions) { 140 | UIAlertAction *newAction = [UIAlertAction actionWithTitle:action.title style:(UIAlertActionStyle)action.style handler:^(UIAlertAction *newAction) { 141 | if (action.handler) 142 | action.handler(action); 143 | }]; 144 | [newAlertController addAction:newAction]; 145 | } 146 | 147 | for (UITextField *textField in alertController.textFields) { 148 | [newAlertController addTextFieldWithConfigurationHandler:^(UITextField *newTextField) { 149 | void (^handler)(UITextField *textField) = alertController.configurationHandlers[[NSValue valueWithNonretainedObject:textField]]; 150 | if (handler) 151 | handler(newTextField); 152 | }]; 153 | } 154 | 155 | [self presentViewController:newAlertController animated:animated completion:completion]; 156 | } else { 157 | if (alertController.preferredStyle == LEAlertControllerStyleAlert) { 158 | UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:alertController.title message:alertController.message delegate:nil cancelButtonTitle:nil otherButtonTitles:nil]; 159 | 160 | for (LEAlertAction *action in alertController.actions) { 161 | [alertView addButtonWithTitle:action.title]; 162 | 163 | if (alertView.cancelButtonIndex == -1 && action.style == LEAlertActionStyleCancel) 164 | alertView.cancelButtonIndex = alertView.numberOfButtons - 1; 165 | 166 | action.enabled = YES; 167 | } 168 | 169 | if (alertController.textFields.count) { 170 | if (alertController.textFields.count == 1) { 171 | alertView.alertViewStyle = UIAlertViewStylePlainTextInput; 172 | 173 | UITextField *textField = [alertView textFieldAtIndex:0]; 174 | alertController.mutableTextFields = [NSMutableArray arrayWithObject:textField]; 175 | } else { 176 | alertView.alertViewStyle = UIAlertViewStyleLoginAndPasswordInput; 177 | 178 | UITextField *firstTextField = [alertView textFieldAtIndex:0]; 179 | UITextField *secondTextField = [alertView textFieldAtIndex:1]; 180 | alertController.mutableTextFields = [NSMutableArray arrayWithObjects:firstTextField, secondTextField, nil]; 181 | } 182 | } 183 | 184 | alertView.didPresentBlock = ^(UIAlertView *alertView){ 185 | if (completion) 186 | completion(); 187 | }; 188 | 189 | alertView.clickedButtonBlock = ^(UIAlertView *alertView, NSInteger buttonIndex){ 190 | LEAlertAction *action = alertController.actions[buttonIndex]; 191 | if (action.handler) 192 | action.handler(action); 193 | }; 194 | 195 | [alertView show]; 196 | } else { 197 | UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle:alertController.title delegate:nil cancelButtonTitle:nil destructiveButtonTitle:nil otherButtonTitles:nil, nil]; 198 | 199 | for (LEAlertAction *action in alertController.actions) { 200 | [actionSheet addButtonWithTitle:action.title]; 201 | 202 | if (actionSheet.cancelButtonIndex == -1 && action.style == LEAlertActionStyleCancel) 203 | actionSheet.cancelButtonIndex = actionSheet.numberOfButtons - 1; 204 | 205 | if (actionSheet.destructiveButtonIndex == -1 && action.style == LEAlertActionStyleDestructive) 206 | actionSheet.destructiveButtonIndex = actionSheet.numberOfButtons - 1; 207 | 208 | action.enabled = YES; 209 | } 210 | 211 | actionSheet.didPresentBlock = ^(UIActionSheet *actionSheet){ 212 | if (completion) 213 | completion(); 214 | }; 215 | 216 | actionSheet.clickedButtonBlock = ^(UIActionSheet *actionSheet, NSInteger buttonIndex){ 217 | LEAlertAction *action = alertController.actions[buttonIndex]; 218 | if (action.handler) 219 | action.handler(action); 220 | }; 221 | 222 | [actionSheet showInView:self.view]; 223 | } 224 | } 225 | } 226 | 227 | @end 228 | -------------------------------------------------------------------------------- /LEAlertController/UIActionSheet+LEBlocks.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIActionSheet+LEBlocks.h 3 | // LEAlertController 4 | // 5 | // Created by Lasha Efremidze on 3/25/15. 6 | // Copyright (c) 2015 Lasha Efremidze. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | typedef void (^UIActionSheetBlock)(UIActionSheet *actionSheet); 12 | typedef void (^UIActionSheetCompletionBlock)(UIActionSheet *actionSheet, NSInteger buttonIndex); 13 | 14 | @interface UIActionSheet (LEBlocks) 15 | 16 | @property (nonatomic, copy) UIActionSheetBlock didPresentBlock; 17 | @property (nonatomic, copy) UIActionSheetCompletionBlock clickedButtonBlock; 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /LEAlertController/UIActionSheet+LEBlocks.m: -------------------------------------------------------------------------------- 1 | // 2 | // UIActionSheet+LEBlocks.m 3 | // LEAlertController 4 | // 5 | // Created by Lasha Efremidze on 3/25/15. 6 | // Copyright (c) 2015 Lasha Efremidze. All rights reserved. 7 | // 8 | 9 | #import "UIActionSheet+LEBlocks.h" 10 | 11 | #import 12 | 13 | static char UIActionSheetDelegateKey; 14 | 15 | static char UIActionSheetDidPresentBlockKey; 16 | static char UIActionSheetClickedButtonBlockKey; 17 | 18 | @interface UIActionSheet () 19 | 20 | @end 21 | 22 | @implementation UIActionSheet (LEBlocks) 23 | 24 | - (void)checkDelegate 25 | { 26 | if (self.delegate != self) { 27 | objc_setAssociatedObject(self, &UIActionSheetDelegateKey, self.delegate, OBJC_ASSOCIATION_ASSIGN); 28 | self.delegate = self; 29 | } 30 | } 31 | 32 | - (id)originalDelegate 33 | { 34 | return objc_getAssociatedObject(self, &UIActionSheetDelegateKey); 35 | } 36 | 37 | #pragma mark - 38 | 39 | - (UIActionSheetBlock)didPresentBlock 40 | { 41 | return objc_getAssociatedObject(self, &UIActionSheetDidPresentBlockKey); 42 | } 43 | 44 | - (void)setDidPresentBlock:(UIActionSheetBlock)didPresentBlock 45 | { 46 | [self checkDelegate]; 47 | objc_setAssociatedObject(self, &UIActionSheetDidPresentBlockKey, didPresentBlock, OBJC_ASSOCIATION_COPY); 48 | } 49 | 50 | - (UIActionSheetCompletionBlock)clickedButtonBlock 51 | { 52 | return objc_getAssociatedObject(self, &UIActionSheetClickedButtonBlockKey); 53 | } 54 | 55 | - (void)setClickedButtonBlock:(UIActionSheetCompletionBlock)clickedButtonBlock 56 | { 57 | [self checkDelegate]; 58 | objc_setAssociatedObject(self, &UIActionSheetClickedButtonBlockKey, clickedButtonBlock, OBJC_ASSOCIATION_COPY); 59 | } 60 | 61 | #pragma mark - UIActionSheetDelegate 62 | 63 | - (void)didPresentActionSheet:(UIActionSheet *)actionSheet 64 | { 65 | UIActionSheetBlock block = self.didPresentBlock; 66 | if (block) 67 | block(actionSheet); 68 | 69 | id originalDelegate = [self originalDelegate]; 70 | if ([originalDelegate respondsToSelector:@selector(didPresentActionSheet:)]) 71 | [originalDelegate didPresentActionSheet:actionSheet]; 72 | } 73 | 74 | - (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex 75 | { 76 | UIActionSheetCompletionBlock block = self.clickedButtonBlock; 77 | if (block) 78 | block(actionSheet, buttonIndex); 79 | 80 | id originalDelegate = [self originalDelegate]; 81 | if ([originalDelegate respondsToSelector:@selector(actionSheet:clickedButtonAtIndex:)]) 82 | [originalDelegate actionSheet:actionSheet clickedButtonAtIndex:buttonIndex]; 83 | } 84 | 85 | @end 86 | -------------------------------------------------------------------------------- /LEAlertController/UIAlertView+LEBlocks.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIAlertView+LEBlocks.h 3 | // LEAlertController 4 | // 5 | // Created by Lasha Efremidze on 3/25/15. 6 | // Copyright (c) 2015 Lasha Efremidze. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | typedef void (^UIAlertViewBlock)(UIAlertView *alertView); 12 | typedef void (^UIAlertViewCompletionBlock)(UIAlertView *alertView, NSInteger buttonIndex); 13 | 14 | @interface UIAlertView (LEBlocks) 15 | 16 | @property (nonatomic, copy) UIAlertViewBlock didPresentBlock; 17 | @property (nonatomic, copy) UIAlertViewCompletionBlock clickedButtonBlock; 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /LEAlertController/UIAlertView+LEBlocks.m: -------------------------------------------------------------------------------- 1 | // 2 | // UIAlertView+LEBlocks.m 3 | // LEAlertController 4 | // 5 | // Created by Lasha Efremidze on 3/25/15. 6 | // Copyright (c) 2015 Lasha Efremidze. All rights reserved. 7 | // 8 | 9 | #import "UIAlertView+LEBlocks.h" 10 | 11 | #import 12 | 13 | static char UIAlertViewDelegateKey; 14 | 15 | static char UIAlertViewDidPresentBlockKey; 16 | static char UIAlertViewClickedButtonBlockKey; 17 | 18 | @interface UIAlertView () 19 | 20 | @end 21 | 22 | @implementation UIAlertView (LEBlocks) 23 | 24 | - (void)checkDelegate 25 | { 26 | if (self.delegate != self) { 27 | objc_setAssociatedObject(self, &UIAlertViewDelegateKey, self.delegate, OBJC_ASSOCIATION_ASSIGN); 28 | self.delegate = self; 29 | } 30 | } 31 | 32 | - (id)originalDelegate 33 | { 34 | return objc_getAssociatedObject(self, &UIAlertViewDelegateKey); 35 | } 36 | 37 | #pragma mark - 38 | 39 | - (UIAlertViewBlock)didPresentBlock 40 | { 41 | return objc_getAssociatedObject(self, &UIAlertViewDidPresentBlockKey); 42 | } 43 | 44 | - (void)setDidPresentBlock:(UIAlertViewBlock)didPresentBlock 45 | { 46 | [self checkDelegate]; 47 | objc_setAssociatedObject(self, &UIAlertViewDidPresentBlockKey, didPresentBlock, OBJC_ASSOCIATION_COPY); 48 | } 49 | 50 | - (UIAlertViewCompletionBlock)clickedButtonBlock 51 | { 52 | return objc_getAssociatedObject(self, &UIAlertViewClickedButtonBlockKey); 53 | } 54 | 55 | - (void)setClickedButtonBlock:(UIAlertViewCompletionBlock)clickedButtonBlock 56 | { 57 | [self checkDelegate]; 58 | objc_setAssociatedObject(self, &UIAlertViewClickedButtonBlockKey, clickedButtonBlock, OBJC_ASSOCIATION_COPY); 59 | } 60 | 61 | #pragma mark - UIAlertViewDelegate 62 | 63 | - (void)didPresentAlertView:(UIAlertView *)alertView 64 | { 65 | UIAlertViewBlock block = self.didPresentBlock; 66 | if (block) 67 | block(alertView); 68 | 69 | id originalDelegate = [self originalDelegate]; 70 | if ([originalDelegate respondsToSelector:@selector(didPresentAlertView:)]) 71 | [originalDelegate didPresentAlertView:alertView]; 72 | } 73 | 74 | - (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex 75 | { 76 | UIAlertViewCompletionBlock block = self.clickedButtonBlock; 77 | if (block) 78 | block(alertView, buttonIndex); 79 | 80 | id originalDelegate = [self originalDelegate]; 81 | if ([originalDelegate respondsToSelector:@selector(alertView:clickedButtonAtIndex:)]) 82 | [originalDelegate alertView:alertView clickedButtonAtIndex:buttonIndex]; 83 | } 84 | 85 | @end 86 | -------------------------------------------------------------------------------- /LEAlertControllerDemo.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 8B283DB71AD4FE3E004F9AD3 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 8B283DB61AD4FE3E004F9AD3 /* main.m */; }; 11 | 8B283DBA1AD4FE3E004F9AD3 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 8B283DB91AD4FE3E004F9AD3 /* AppDelegate.m */; }; 12 | 8B283DBD1AD4FE3E004F9AD3 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 8B283DBC1AD4FE3E004F9AD3 /* ViewController.m */; }; 13 | 8B283DC01AD4FE3E004F9AD3 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 8B283DBE1AD4FE3E004F9AD3 /* Main.storyboard */; }; 14 | 8B283DC21AD4FE3E004F9AD3 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 8B283DC11AD4FE3E004F9AD3 /* Images.xcassets */; }; 15 | 8B283DC51AD4FE3E004F9AD3 /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = 8B283DC31AD4FE3E004F9AD3 /* LaunchScreen.xib */; }; 16 | 8B8E991B1AD50AF1005CDF7C /* UIActionSheet+LEBlocks.m in Sources */ = {isa = PBXBuildFile; fileRef = 8B8E99181AD50AF1005CDF7C /* UIActionSheet+LEBlocks.m */; }; 17 | 8B8E991C1AD50AF1005CDF7C /* UIAlertView+LEBlocks.m in Sources */ = {isa = PBXBuildFile; fileRef = 8B8E991A1AD50AF1005CDF7C /* UIAlertView+LEBlocks.m */; }; 18 | 8BC6CC0F1AD4FF260051F212 /* LEAlertController.m in Sources */ = {isa = PBXBuildFile; fileRef = 8BC6CC0E1AD4FF260051F212 /* LEAlertController.m */; }; 19 | /* End PBXBuildFile section */ 20 | 21 | /* Begin PBXFileReference section */ 22 | 8B283DB11AD4FE3E004F9AD3 /* LEAlertControllerDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = LEAlertControllerDemo.app; sourceTree = BUILT_PRODUCTS_DIR; }; 23 | 8B283DB51AD4FE3E004F9AD3 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 24 | 8B283DB61AD4FE3E004F9AD3 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 25 | 8B283DB81AD4FE3E004F9AD3 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 26 | 8B283DB91AD4FE3E004F9AD3 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 27 | 8B283DBB1AD4FE3E004F9AD3 /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; 28 | 8B283DBC1AD4FE3E004F9AD3 /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; 29 | 8B283DBF1AD4FE3E004F9AD3 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 30 | 8B283DC11AD4FE3E004F9AD3 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; 31 | 8B283DC41AD4FE3E004F9AD3 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/LaunchScreen.xib; sourceTree = ""; }; 32 | 8B8E99171AD50AF1005CDF7C /* UIActionSheet+LEBlocks.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIActionSheet+LEBlocks.h"; sourceTree = ""; }; 33 | 8B8E99181AD50AF1005CDF7C /* UIActionSheet+LEBlocks.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIActionSheet+LEBlocks.m"; sourceTree = ""; }; 34 | 8B8E99191AD50AF1005CDF7C /* UIAlertView+LEBlocks.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIAlertView+LEBlocks.h"; sourceTree = ""; }; 35 | 8B8E991A1AD50AF1005CDF7C /* UIAlertView+LEBlocks.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIAlertView+LEBlocks.m"; sourceTree = ""; }; 36 | 8BC6CC0D1AD4FF260051F212 /* LEAlertController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LEAlertController.h; sourceTree = ""; }; 37 | 8BC6CC0E1AD4FF260051F212 /* LEAlertController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LEAlertController.m; sourceTree = ""; }; 38 | /* End PBXFileReference section */ 39 | 40 | /* Begin PBXFrameworksBuildPhase section */ 41 | 8B283DAE1AD4FE3E004F9AD3 /* Frameworks */ = { 42 | isa = PBXFrameworksBuildPhase; 43 | buildActionMask = 2147483647; 44 | files = ( 45 | ); 46 | runOnlyForDeploymentPostprocessing = 0; 47 | }; 48 | /* End PBXFrameworksBuildPhase section */ 49 | 50 | /* Begin PBXGroup section */ 51 | 8B283DA81AD4FE3E004F9AD3 = { 52 | isa = PBXGroup; 53 | children = ( 54 | 8BC6CC0C1AD4FF260051F212 /* LEAlertController */, 55 | 8B283DB31AD4FE3E004F9AD3 /* LEAlertControllerDemo */, 56 | 8B283DB21AD4FE3E004F9AD3 /* Products */, 57 | ); 58 | sourceTree = ""; 59 | }; 60 | 8B283DB21AD4FE3E004F9AD3 /* Products */ = { 61 | isa = PBXGroup; 62 | children = ( 63 | 8B283DB11AD4FE3E004F9AD3 /* LEAlertControllerDemo.app */, 64 | ); 65 | name = Products; 66 | sourceTree = ""; 67 | }; 68 | 8B283DB31AD4FE3E004F9AD3 /* LEAlertControllerDemo */ = { 69 | isa = PBXGroup; 70 | children = ( 71 | 8B283DB81AD4FE3E004F9AD3 /* AppDelegate.h */, 72 | 8B283DB91AD4FE3E004F9AD3 /* AppDelegate.m */, 73 | 8B283DC11AD4FE3E004F9AD3 /* Images.xcassets */, 74 | 8B283DC31AD4FE3E004F9AD3 /* LaunchScreen.xib */, 75 | 8B283DBE1AD4FE3E004F9AD3 /* Main.storyboard */, 76 | 8B283DB41AD4FE3E004F9AD3 /* Supporting Files */, 77 | 8B283DBB1AD4FE3E004F9AD3 /* ViewController.h */, 78 | 8B283DBC1AD4FE3E004F9AD3 /* ViewController.m */, 79 | ); 80 | path = LEAlertControllerDemo; 81 | sourceTree = ""; 82 | }; 83 | 8B283DB41AD4FE3E004F9AD3 /* Supporting Files */ = { 84 | isa = PBXGroup; 85 | children = ( 86 | 8B283DB51AD4FE3E004F9AD3 /* Info.plist */, 87 | 8B283DB61AD4FE3E004F9AD3 /* main.m */, 88 | ); 89 | name = "Supporting Files"; 90 | sourceTree = ""; 91 | }; 92 | 8BC6CC0C1AD4FF260051F212 /* LEAlertController */ = { 93 | isa = PBXGroup; 94 | children = ( 95 | 8BC6CC0D1AD4FF260051F212 /* LEAlertController.h */, 96 | 8BC6CC0E1AD4FF260051F212 /* LEAlertController.m */, 97 | 8B8E99171AD50AF1005CDF7C /* UIActionSheet+LEBlocks.h */, 98 | 8B8E99181AD50AF1005CDF7C /* UIActionSheet+LEBlocks.m */, 99 | 8B8E99191AD50AF1005CDF7C /* UIAlertView+LEBlocks.h */, 100 | 8B8E991A1AD50AF1005CDF7C /* UIAlertView+LEBlocks.m */, 101 | ); 102 | path = LEAlertController; 103 | sourceTree = ""; 104 | }; 105 | /* End PBXGroup section */ 106 | 107 | /* Begin PBXNativeTarget section */ 108 | 8B283DB01AD4FE3E004F9AD3 /* LEAlertControllerDemo */ = { 109 | isa = PBXNativeTarget; 110 | buildConfigurationList = 8B283DD41AD4FE3E004F9AD3 /* Build configuration list for PBXNativeTarget "LEAlertControllerDemo" */; 111 | buildPhases = ( 112 | 8B283DAD1AD4FE3E004F9AD3 /* Sources */, 113 | 8B283DAE1AD4FE3E004F9AD3 /* Frameworks */, 114 | 8B283DAF1AD4FE3E004F9AD3 /* Resources */, 115 | ); 116 | buildRules = ( 117 | ); 118 | dependencies = ( 119 | ); 120 | name = LEAlertControllerDemo; 121 | productName = LEAlertControllerDemo; 122 | productReference = 8B283DB11AD4FE3E004F9AD3 /* LEAlertControllerDemo.app */; 123 | productType = "com.apple.product-type.application"; 124 | }; 125 | /* End PBXNativeTarget section */ 126 | 127 | /* Begin PBXProject section */ 128 | 8B283DA91AD4FE3E004F9AD3 /* Project object */ = { 129 | isa = PBXProject; 130 | attributes = { 131 | LastUpgradeCheck = 0630; 132 | ORGANIZATIONNAME = "Lasha Efremidze"; 133 | TargetAttributes = { 134 | 8B283DB01AD4FE3E004F9AD3 = { 135 | CreatedOnToolsVersion = 6.3; 136 | }; 137 | }; 138 | }; 139 | buildConfigurationList = 8B283DAC1AD4FE3E004F9AD3 /* Build configuration list for PBXProject "LEAlertControllerDemo" */; 140 | compatibilityVersion = "Xcode 3.2"; 141 | developmentRegion = English; 142 | hasScannedForEncodings = 0; 143 | knownRegions = ( 144 | en, 145 | Base, 146 | ); 147 | mainGroup = 8B283DA81AD4FE3E004F9AD3; 148 | productRefGroup = 8B283DB21AD4FE3E004F9AD3 /* Products */; 149 | projectDirPath = ""; 150 | projectRoot = ""; 151 | targets = ( 152 | 8B283DB01AD4FE3E004F9AD3 /* LEAlertControllerDemo */, 153 | ); 154 | }; 155 | /* End PBXProject section */ 156 | 157 | /* Begin PBXResourcesBuildPhase section */ 158 | 8B283DAF1AD4FE3E004F9AD3 /* Resources */ = { 159 | isa = PBXResourcesBuildPhase; 160 | buildActionMask = 2147483647; 161 | files = ( 162 | 8B283DC01AD4FE3E004F9AD3 /* Main.storyboard in Resources */, 163 | 8B283DC51AD4FE3E004F9AD3 /* LaunchScreen.xib in Resources */, 164 | 8B283DC21AD4FE3E004F9AD3 /* Images.xcassets in Resources */, 165 | ); 166 | runOnlyForDeploymentPostprocessing = 0; 167 | }; 168 | /* End PBXResourcesBuildPhase section */ 169 | 170 | /* Begin PBXSourcesBuildPhase section */ 171 | 8B283DAD1AD4FE3E004F9AD3 /* Sources */ = { 172 | isa = PBXSourcesBuildPhase; 173 | buildActionMask = 2147483647; 174 | files = ( 175 | 8B283DBD1AD4FE3E004F9AD3 /* ViewController.m in Sources */, 176 | 8B283DBA1AD4FE3E004F9AD3 /* AppDelegate.m in Sources */, 177 | 8B8E991B1AD50AF1005CDF7C /* UIActionSheet+LEBlocks.m in Sources */, 178 | 8B283DB71AD4FE3E004F9AD3 /* main.m in Sources */, 179 | 8B8E991C1AD50AF1005CDF7C /* UIAlertView+LEBlocks.m in Sources */, 180 | 8BC6CC0F1AD4FF260051F212 /* LEAlertController.m in Sources */, 181 | ); 182 | runOnlyForDeploymentPostprocessing = 0; 183 | }; 184 | /* End PBXSourcesBuildPhase section */ 185 | 186 | /* Begin PBXVariantGroup section */ 187 | 8B283DBE1AD4FE3E004F9AD3 /* Main.storyboard */ = { 188 | isa = PBXVariantGroup; 189 | children = ( 190 | 8B283DBF1AD4FE3E004F9AD3 /* Base */, 191 | ); 192 | name = Main.storyboard; 193 | sourceTree = ""; 194 | }; 195 | 8B283DC31AD4FE3E004F9AD3 /* LaunchScreen.xib */ = { 196 | isa = PBXVariantGroup; 197 | children = ( 198 | 8B283DC41AD4FE3E004F9AD3 /* Base */, 199 | ); 200 | name = LaunchScreen.xib; 201 | sourceTree = ""; 202 | }; 203 | /* End PBXVariantGroup section */ 204 | 205 | /* Begin XCBuildConfiguration section */ 206 | 8B283DD21AD4FE3E004F9AD3 /* Debug */ = { 207 | isa = XCBuildConfiguration; 208 | buildSettings = { 209 | ALWAYS_SEARCH_USER_PATHS = NO; 210 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 211 | CLANG_CXX_LIBRARY = "libc++"; 212 | CLANG_ENABLE_MODULES = YES; 213 | CLANG_ENABLE_OBJC_ARC = YES; 214 | CLANG_WARN_BOOL_CONVERSION = YES; 215 | CLANG_WARN_CONSTANT_CONVERSION = YES; 216 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 217 | CLANG_WARN_EMPTY_BODY = YES; 218 | CLANG_WARN_ENUM_CONVERSION = YES; 219 | CLANG_WARN_INT_CONVERSION = YES; 220 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 221 | CLANG_WARN_UNREACHABLE_CODE = YES; 222 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 223 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 224 | COPY_PHASE_STRIP = NO; 225 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 226 | ENABLE_STRICT_OBJC_MSGSEND = YES; 227 | GCC_C_LANGUAGE_STANDARD = gnu99; 228 | GCC_DYNAMIC_NO_PIC = NO; 229 | GCC_NO_COMMON_BLOCKS = YES; 230 | GCC_OPTIMIZATION_LEVEL = 0; 231 | GCC_PREPROCESSOR_DEFINITIONS = ( 232 | "DEBUG=1", 233 | "$(inherited)", 234 | ); 235 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 236 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 237 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 238 | GCC_WARN_UNDECLARED_SELECTOR = YES; 239 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 240 | GCC_WARN_UNUSED_FUNCTION = YES; 241 | GCC_WARN_UNUSED_VARIABLE = YES; 242 | IPHONEOS_DEPLOYMENT_TARGET = 7.0; 243 | MTL_ENABLE_DEBUG_INFO = YES; 244 | ONLY_ACTIVE_ARCH = YES; 245 | SDKROOT = iphoneos; 246 | TARGETED_DEVICE_FAMILY = "1,2"; 247 | }; 248 | name = Debug; 249 | }; 250 | 8B283DD31AD4FE3E004F9AD3 /* Release */ = { 251 | isa = XCBuildConfiguration; 252 | buildSettings = { 253 | ALWAYS_SEARCH_USER_PATHS = NO; 254 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 255 | CLANG_CXX_LIBRARY = "libc++"; 256 | CLANG_ENABLE_MODULES = YES; 257 | CLANG_ENABLE_OBJC_ARC = YES; 258 | CLANG_WARN_BOOL_CONVERSION = YES; 259 | CLANG_WARN_CONSTANT_CONVERSION = YES; 260 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 261 | CLANG_WARN_EMPTY_BODY = YES; 262 | CLANG_WARN_ENUM_CONVERSION = YES; 263 | CLANG_WARN_INT_CONVERSION = YES; 264 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 265 | CLANG_WARN_UNREACHABLE_CODE = YES; 266 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 267 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 268 | COPY_PHASE_STRIP = NO; 269 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 270 | ENABLE_NS_ASSERTIONS = NO; 271 | ENABLE_STRICT_OBJC_MSGSEND = YES; 272 | GCC_C_LANGUAGE_STANDARD = gnu99; 273 | GCC_NO_COMMON_BLOCKS = YES; 274 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 275 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 276 | GCC_WARN_UNDECLARED_SELECTOR = YES; 277 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 278 | GCC_WARN_UNUSED_FUNCTION = YES; 279 | GCC_WARN_UNUSED_VARIABLE = YES; 280 | IPHONEOS_DEPLOYMENT_TARGET = 7.0; 281 | MTL_ENABLE_DEBUG_INFO = NO; 282 | SDKROOT = iphoneos; 283 | TARGETED_DEVICE_FAMILY = "1,2"; 284 | VALIDATE_PRODUCT = YES; 285 | }; 286 | name = Release; 287 | }; 288 | 8B283DD51AD4FE3E004F9AD3 /* Debug */ = { 289 | isa = XCBuildConfiguration; 290 | buildSettings = { 291 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 292 | INFOPLIST_FILE = LEAlertControllerDemo/Info.plist; 293 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 294 | PRODUCT_NAME = "$(TARGET_NAME)"; 295 | }; 296 | name = Debug; 297 | }; 298 | 8B283DD61AD4FE3E004F9AD3 /* Release */ = { 299 | isa = XCBuildConfiguration; 300 | buildSettings = { 301 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 302 | INFOPLIST_FILE = LEAlertControllerDemo/Info.plist; 303 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 304 | PRODUCT_NAME = "$(TARGET_NAME)"; 305 | }; 306 | name = Release; 307 | }; 308 | /* End XCBuildConfiguration section */ 309 | 310 | /* Begin XCConfigurationList section */ 311 | 8B283DAC1AD4FE3E004F9AD3 /* Build configuration list for PBXProject "LEAlertControllerDemo" */ = { 312 | isa = XCConfigurationList; 313 | buildConfigurations = ( 314 | 8B283DD21AD4FE3E004F9AD3 /* Debug */, 315 | 8B283DD31AD4FE3E004F9AD3 /* Release */, 316 | ); 317 | defaultConfigurationIsVisible = 0; 318 | defaultConfigurationName = Release; 319 | }; 320 | 8B283DD41AD4FE3E004F9AD3 /* Build configuration list for PBXNativeTarget "LEAlertControllerDemo" */ = { 321 | isa = XCConfigurationList; 322 | buildConfigurations = ( 323 | 8B283DD51AD4FE3E004F9AD3 /* Debug */, 324 | 8B283DD61AD4FE3E004F9AD3 /* Release */, 325 | ); 326 | defaultConfigurationIsVisible = 0; 327 | defaultConfigurationName = Release; 328 | }; 329 | /* End XCConfigurationList section */ 330 | }; 331 | rootObject = 8B283DA91AD4FE3E004F9AD3 /* Project object */; 332 | } 333 | -------------------------------------------------------------------------------- /LEAlertControllerDemo.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /LEAlertControllerDemo.xcodeproj/xcshareddata/xcschemes/LEAlertControllerDemo.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 29 | 35 | 36 | 37 | 38 | 39 | 44 | 45 | 47 | 53 | 54 | 55 | 56 | 57 | 63 | 64 | 65 | 66 | 75 | 77 | 83 | 84 | 85 | 86 | 87 | 88 | 94 | 96 | 102 | 103 | 104 | 105 | 107 | 108 | 111 | 112 | 113 | -------------------------------------------------------------------------------- /LEAlertControllerDemo/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // LEAlertControllerDemo 4 | // 5 | // Created by Lasha Efremidze on 4/7/15. 6 | // Copyright (c) 2015 Lasha Efremidze. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface AppDelegate : UIResponder 12 | 13 | @property (strong, nonatomic) UIWindow *window; 14 | 15 | 16 | @end 17 | 18 | -------------------------------------------------------------------------------- /LEAlertControllerDemo/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // LEAlertControllerDemo 4 | // 5 | // Created by Lasha Efremidze on 4/7/15. 6 | // Copyright (c) 2015 Lasha Efremidze. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | 11 | @interface AppDelegate () 12 | 13 | @end 14 | 15 | @implementation AppDelegate 16 | 17 | 18 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 19 | // Override point for customization after application launch. 20 | return YES; 21 | } 22 | 23 | - (void)applicationWillResignActive:(UIApplication *)application { 24 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 25 | // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. 26 | } 27 | 28 | - (void)applicationDidEnterBackground:(UIApplication *)application { 29 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 30 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 31 | } 32 | 33 | - (void)applicationWillEnterForeground:(UIApplication *)application { 34 | // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. 35 | } 36 | 37 | - (void)applicationDidBecomeActive:(UIApplication *)application { 38 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 39 | } 40 | 41 | - (void)applicationWillTerminate:(UIApplication *)application { 42 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 43 | } 44 | 45 | @end 46 | -------------------------------------------------------------------------------- /LEAlertControllerDemo/Base.lproj/LaunchScreen.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 20 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /LEAlertControllerDemo/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 35 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | -------------------------------------------------------------------------------- /LEAlertControllerDemo/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "29x29", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "40x40", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "40x40", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "60x60", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "60x60", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "idiom" : "ipad", 35 | "size" : "29x29", 36 | "scale" : "1x" 37 | }, 38 | { 39 | "idiom" : "ipad", 40 | "size" : "29x29", 41 | "scale" : "2x" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "size" : "40x40", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "size" : "40x40", 51 | "scale" : "2x" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "size" : "76x76", 56 | "scale" : "1x" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "size" : "76x76", 61 | "scale" : "2x" 62 | } 63 | ], 64 | "info" : { 65 | "version" : 1, 66 | "author" : "xcode" 67 | } 68 | } -------------------------------------------------------------------------------- /LEAlertControllerDemo/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | com.efremidze.$(PRODUCT_NAME:rfc1034identifier) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIMainStoryboardFile 28 | Main 29 | UIRequiredDeviceCapabilities 30 | 31 | armv7 32 | 33 | UISupportedInterfaceOrientations 34 | 35 | UIInterfaceOrientationPortrait 36 | UIInterfaceOrientationLandscapeLeft 37 | UIInterfaceOrientationLandscapeRight 38 | 39 | UISupportedInterfaceOrientations~ipad 40 | 41 | UIInterfaceOrientationPortrait 42 | UIInterfaceOrientationPortraitUpsideDown 43 | UIInterfaceOrientationLandscapeLeft 44 | UIInterfaceOrientationLandscapeRight 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /LEAlertControllerDemo/ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // LEAlertControllerDemo 4 | // 5 | // Created by Lasha Efremidze on 4/7/15. 6 | // Copyright (c) 2015 Lasha Efremidze. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ViewController : UIViewController 12 | 13 | 14 | @end 15 | 16 | -------------------------------------------------------------------------------- /LEAlertControllerDemo/ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.m 3 | // LEAlertControllerDemo 4 | // 5 | // Created by Lasha Efremidze on 4/7/15. 6 | // Copyright (c) 2015 Lasha Efremidze. All rights reserved. 7 | // 8 | 9 | #import "ViewController.h" 10 | #import "LEAlertController.h" 11 | 12 | @interface ViewController () 13 | 14 | @end 15 | 16 | @implementation ViewController 17 | 18 | - (void)viewDidLoad { 19 | [super viewDidLoad]; 20 | // Do any additional setup after loading the view, typically from a nib. 21 | } 22 | 23 | - (void)didReceiveMemoryWarning { 24 | [super didReceiveMemoryWarning]; 25 | // Dispose of any resources that can be recreated. 26 | } 27 | 28 | - (IBAction)didTouchOnAlertButton:(id)sender 29 | { 30 | LEAlertController *alertController = [LEAlertController alertControllerWithTitle:@"Default Style" message:@"A standard alert." preferredStyle:LEAlertControllerStyleAlert]; 31 | 32 | LEAlertAction *cancelAction = [LEAlertAction actionWithTitle:@"Cancel" style:LEAlertActionStyleCancel handler:^(LEAlertAction *action) { 33 | // handle cancel button action 34 | NSLog(@"cancel button pressed"); 35 | }]; 36 | [alertController addAction:cancelAction]; 37 | 38 | LEAlertAction *defaultAction = [LEAlertAction actionWithTitle:@"OK" style:LEAlertActionStyleDefault handler:^(LEAlertAction *action) { 39 | // handle default button action 40 | NSLog(@"default button pressed"); 41 | }]; 42 | [alertController addAction:defaultAction]; 43 | 44 | [self presentAlertController:alertController animated:YES completion:nil]; 45 | } 46 | 47 | - (IBAction)didTouchOnActionSheetButton:(id)sender 48 | { 49 | LEAlertController *alertController = [LEAlertController alertControllerWithTitle:nil message:@"A standard action sheet." preferredStyle:LEAlertControllerStyleActionSheet]; 50 | 51 | LEAlertAction *destructiveAction = [LEAlertAction actionWithTitle:@"Destroy" style:LEAlertActionStyleDestructive handler:^(LEAlertAction *action) { 52 | // handle destructive button action 53 | NSLog(@"destructive button pressed"); 54 | }]; 55 | [alertController addAction:destructiveAction]; 56 | 57 | LEAlertAction *defaultAction = [LEAlertAction actionWithTitle:@"OK" style:LEAlertActionStyleDefault handler:^(LEAlertAction *action) { 58 | // handle default button action 59 | NSLog(@"default button pressed"); 60 | }]; 61 | [alertController addAction:defaultAction]; 62 | 63 | LEAlertAction *cancelAction = [LEAlertAction actionWithTitle:@"Cancel" style:LEAlertActionStyleCancel handler:^(LEAlertAction *action) { 64 | // handle cancel button action 65 | NSLog(@"cancel button pressed"); 66 | }]; 67 | [alertController addAction:cancelAction]; 68 | 69 | [self presentAlertController:alertController animated:YES completion:nil]; 70 | } 71 | 72 | @end 73 | -------------------------------------------------------------------------------- /LEAlertControllerDemo/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // LEAlertControllerDemo 4 | // 5 | // Created by Lasha Efremidze on 4/7/15. 6 | // Copyright (c) 2015 Lasha Efremidze. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "AppDelegate.h" 11 | 12 | int main(int argc, char * argv[]) { 13 | @autoreleasepool { 14 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 Lasha Efremidze 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # LEAlertController 2 | 3 | [![CI Status](http://img.shields.io/travis/efremidze/LEAlertController.svg?style=flat)](https://travis-ci.org/efremidze/LEAlertController) 4 | [![Version](https://img.shields.io/cocoapods/v/LEAlertController.svg?style=flat)](http://cocoapods.org/pods/LEAlertController) 5 | [![License](https://img.shields.io/cocoapods/l/LEAlertController.svg?style=flat)](http://cocoapods.org/pods/LEAlertController) 6 | [![Platform](https://img.shields.io/cocoapods/p/LEAlertController.svg?style=flat)](http://cocoapods.org/pods/LEAlertController) 7 | 8 | ## Overview 9 | 10 | `LEAlertController` is a lightweight `UIAlertController` extension for iOS 7 support. Fallbacks to using `UIAlertView` and `UIActionSheet` for iOS 7. 11 | 12 | ![UIAlertView Screenshot](Screenshots/alert.png) 13 | ![UIActionSheet Screenshot](Screenshots/actionsheet.png) 14 | 15 | ## Usage 16 | 17 | ### Installation 18 | 19 | LEAlertController is available through [CocoaPods](http://cocoapods.org). To install 20 | it, simply add the following line to your Podfile: 21 | 22 | ```ruby 23 | pod "LEAlertController" 24 | ``` 25 | 26 | ### Example 27 | 28 | Use like a `UIAlertController` 29 | 30 | ```objectivec 31 | LEAlertController *alertController = [LEAlertController alertControllerWithTitle:@"Default Style" message:@"A standard alert." preferredStyle:LEAlertControllerStyleAlert]; 32 | 33 | LEAlertAction *cancelAction = [LEAlertAction actionWithTitle:@"Cancel" style:LEAlertActionStyleCancel handler:^(LEAlertAction *action) { 34 | // handle cancel button action 35 | }]; 36 | [alertController addAction:cancelAction]; 37 | 38 | LEAlertAction *defaultAction = [LEAlertAction actionWithTitle:@"OK" style:LEAlertActionStyleDefault handler:^(LEAlertAction *action) { 39 | // handle default button action 40 | }]; 41 | [alertController addAction:defaultAction]; 42 | 43 | [self presentAlertController:alertController animated:YES completion:nil]; 44 | ``` 45 | 46 | ## Contributions 47 | 48 | Contributions are totally welcome. 49 | 50 | ## License 51 | 52 | LEAlertController is available under the MIT license. See the LICENSE file for more info. 53 | -------------------------------------------------------------------------------- /Screenshots/actionsheet.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/efremidze/LEAlertController/7c093598a7c8aa495f4e9c1a3bc75e17092c0bd3/Screenshots/actionsheet.png -------------------------------------------------------------------------------- /Screenshots/alert.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/efremidze/LEAlertController/7c093598a7c8aa495f4e9c1a3bc75e17092c0bd3/Screenshots/alert.png --------------------------------------------------------------------------------