├── alert7.png ├── alert8.png ├── sheet7.png ├── sheet8.png ├── ARAlertControllerExample ├── Cartfile.resolved ├── Cartfile ├── Podfile ├── Podfile.lock ├── ARAlertControllerExample.xcodeproj │ ├── project.xcworkspace │ │ └── contents.xcworkspacedata │ └── project.pbxproj ├── ARAlertControllerExample │ ├── ViewController.h │ ├── AppDelegate.h │ ├── main.m │ ├── Images.xcassets │ │ ├── LaunchImage.launchimage │ │ │ └── Contents.json │ │ └── AppIcon.appiconset │ │ │ └── Contents.json │ ├── Info.plist │ ├── AppDelegate.m │ ├── Base.lproj │ │ └── Main.storyboard │ └── ViewController.m ├── ARAlertControllerExample.xcworkspace │ └── contents.xcworkspacedata └── ARAlertControllerExampleTests │ ├── Info.plist │ └── ARAlertControllerExampleTests.m ├── .travis.yml ├── ARAlertController.xcodeproj ├── project.xcworkspace │ └── contents.xcworkspacedata ├── xcuserdata │ └── alexruperez.xcuserdatad │ │ └── xcschemes │ │ └── xcschememanagement.plist ├── xcshareddata │ └── xcschemes │ │ └── ARAlertController.xcscheme └── project.pbxproj ├── .gitignore ├── ARAlertControllerTests ├── Info.plist └── ARAlertControllerTests.m ├── ARAlertController ├── Info.plist ├── ARAlertController.h └── ARAlertController.m ├── ARAlertController.podspec ├── LICENSE └── README.md /alert7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexruperez/ARAlertController/HEAD/alert7.png -------------------------------------------------------------------------------- /alert8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexruperez/ARAlertController/HEAD/alert8.png -------------------------------------------------------------------------------- /sheet7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexruperez/ARAlertController/HEAD/sheet7.png -------------------------------------------------------------------------------- /sheet8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexruperez/ARAlertController/HEAD/sheet8.png -------------------------------------------------------------------------------- /ARAlertControllerExample/Cartfile.resolved: -------------------------------------------------------------------------------- 1 | github "alexruperez/ARAlertController" "0.1.0" 2 | -------------------------------------------------------------------------------- /ARAlertControllerExample/Cartfile: -------------------------------------------------------------------------------- 1 | # Require version 0.1.0 or later 2 | github "alexruperez/ARAlertController" >= 0.1.0 -------------------------------------------------------------------------------- /ARAlertControllerExample/Podfile: -------------------------------------------------------------------------------- 1 | source 'https://github.com/CocoaPods/Specs.git' 2 | platform :ios, '7.0' 3 | 4 | pod 'ARAlertController', '~> 0.1' -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: objective-c 2 | before_install: 3 | - gem install xcpretty 4 | script: 5 | - set -o pipefail 6 | - xcodebuild -project ARAlertController.xcodeproj -scheme ARAlertController test -sdk iphonesimulator ONLY_ACTIVE_ARCH=NO | xcpretty -c 7 | -------------------------------------------------------------------------------- /ARAlertController.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /ARAlertControllerExample/Podfile.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - ARAlertController (0.1.3) 3 | 4 | DEPENDENCIES: 5 | - ARAlertController (~> 0.1) 6 | 7 | SPEC CHECKSUMS: 8 | ARAlertController: 926419ea0f263951b524990e2d74920d91609b63 9 | 10 | COCOAPODS: 0.37.1 11 | -------------------------------------------------------------------------------- /ARAlertControllerExample/ARAlertControllerExample.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /ARAlertControllerExample/ARAlertControllerExample/ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // ARAlertControllerExample 4 | // 5 | // Created by alexruperez on 14/2/15. 6 | // Copyright (c) 2015 alexruperez. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ViewController : UIViewController 12 | 13 | 14 | @end 15 | 16 | -------------------------------------------------------------------------------- /ARAlertControllerExample/ARAlertControllerExample.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /ARAlertControllerExample/ARAlertControllerExample/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // ARAlertControllerExample 4 | // 5 | // Created by alexruperez on 14/2/15. 6 | // Copyright (c) 2015 alexruperez. 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 | -------------------------------------------------------------------------------- /ARAlertControllerExample/ARAlertControllerExample/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // ARAlertControllerExample 4 | // 5 | // Created by alexruperez on 14/2/15. 6 | // Copyright (c) 2015 alexruperez. 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 | -------------------------------------------------------------------------------- /ARAlertController.xcodeproj/xcuserdata/alexruperez.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | ARAlertController.xcscheme_^#shared#^_ 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | D5E13A611A8F737B00C9A5F2 16 | 17 | primary 18 | 19 | 20 | D5E13A6C1A8F737C00C9A5F2 21 | 22 | primary 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # OS X 2 | .DS_Store 3 | 4 | # Xcode 5 | build/ 6 | *.pbxuser 7 | !default.pbxuser 8 | *.mode1v3 9 | !default.mode1v3 10 | *.mode2v3 11 | !default.mode2v3 12 | *.perspectivev3 13 | !default.perspectivev3 14 | xcuserdata 15 | *.xccheckout 16 | profile 17 | *.moved-aside 18 | DerivedData 19 | *.hmap 20 | *.ipa 21 | *.xcuserstate 22 | 23 | # Bundler 24 | .bundle 25 | 26 | # CocoaPods 27 | # 28 | # We recommend against adding the Pods directory to your .gitignore. However 29 | # you should judge for yourself, the pros and cons are mentioned at: 30 | # http://guides.cocoapods.org/using/using-cocoapods.html#should-i-ignore-the-pods-directory-in-source-control 31 | # 32 | Pods/ 33 | 34 | # Carthage 35 | # 36 | # Add this line if you want to avoid checking in source code from Carthage dependencies. 37 | Carthage/ -------------------------------------------------------------------------------- /ARAlertControllerTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | com.alexruperez.$(PRODUCT_NAME:rfc1034identifier) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /ARAlertControllerExample/ARAlertControllerExampleTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | com.alexruperez.$(PRODUCT_NAME:rfc1034identifier) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /ARAlertController/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | com.alexruperez.$(PRODUCT_NAME:rfc1034identifier) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | $(CURRENT_PROJECT_VERSION) 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /ARAlertController.podspec: -------------------------------------------------------------------------------- 1 | Pod::Spec.new do |s| 2 | s.name = "ARAlertController" 3 | s.version = "0.1.3" 4 | s.summary = "UIAlertController compatible iOS >= 5.0" 5 | s.homepage = "https://github.com/alexruperez/ARAlertController" 6 | s.screenshots = "https://raw.githubusercontent.com/alexruperez/ARAlertController/master/alert8.png", "https://raw.githubusercontent.com/alexruperez/ARAlertController/master/alert7.png", "https://raw.githubusercontent.com/alexruperez/ARAlertController/master/sheet8.png", "https://raw.githubusercontent.com/alexruperez/ARAlertController/master/sheet7.png" 7 | s.license = 'MIT' 8 | s.author = { "alexruperez" => "contact@alexruperez.com" } 9 | s.source = { :git => "https://github.com/alexruperez/ARAlertController.git", :tag => s.version.to_s } 10 | s.social_media_url = 'https://twitter.com/alexruperez' 11 | 12 | s.platform = :ios, '5.0' 13 | s.requires_arc = true 14 | 15 | s.source_files = 'ARAlertController/ARAlertController.{h,m}' 16 | 17 | s.frameworks = 'UIKit' 18 | end -------------------------------------------------------------------------------- /ARAlertControllerTests/ARAlertControllerTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // ARAlertControllerTests.m 3 | // ARAlertControllerTests 4 | // 5 | // Created by alexruperez on 14/2/15. 6 | // Copyright (c) 2015 alexruperez. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | @interface ARAlertControllerTests : XCTestCase 13 | 14 | @end 15 | 16 | @implementation ARAlertControllerTests 17 | 18 | - (void)setUp { 19 | [super setUp]; 20 | // Put setup code here. This method is called before the invocation of each test method in the class. 21 | } 22 | 23 | - (void)tearDown { 24 | // Put teardown code here. This method is called after the invocation of each test method in the class. 25 | [super tearDown]; 26 | } 27 | 28 | - (void)testExample { 29 | // This is an example of a functional test case. 30 | XCTAssert(YES, @"Pass"); 31 | } 32 | 33 | - (void)testPerformanceExample { 34 | // This is an example of a performance test case. 35 | [self measureBlock:^{ 36 | // Put the code you want to measure the time of here. 37 | }]; 38 | } 39 | 40 | @end 41 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 @alexruperez 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 13 | all 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 21 | THE SOFTWARE. -------------------------------------------------------------------------------- /ARAlertControllerExample/ARAlertControllerExampleTests/ARAlertControllerExampleTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // ARAlertControllerExampleTests.m 3 | // ARAlertControllerExampleTests 4 | // 5 | // Created by alexruperez on 14/2/15. 6 | // Copyright (c) 2015 alexruperez. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | @interface ARAlertControllerExampleTests : XCTestCase 13 | 14 | @end 15 | 16 | @implementation ARAlertControllerExampleTests 17 | 18 | - (void)setUp { 19 | [super setUp]; 20 | // Put setup code here. This method is called before the invocation of each test method in the class. 21 | } 22 | 23 | - (void)tearDown { 24 | // Put teardown code here. This method is called after the invocation of each test method in the class. 25 | [super tearDown]; 26 | } 27 | 28 | - (void)testExample { 29 | // This is an example of a functional test case. 30 | XCTAssert(YES, @"Pass"); 31 | } 32 | 33 | - (void)testPerformanceExample { 34 | // This is an example of a performance test case. 35 | [self measureBlock:^{ 36 | // Put the code you want to measure the time of here. 37 | }]; 38 | } 39 | 40 | @end 41 | -------------------------------------------------------------------------------- /ARAlertControllerExample/ARAlertControllerExample/Images.xcassets/LaunchImage.launchimage/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "orientation" : "portrait", 5 | "idiom" : "ipad", 6 | "minimum-system-version" : "7.0", 7 | "extent" : "full-screen", 8 | "scale" : "2x" 9 | }, 10 | { 11 | "orientation" : "landscape", 12 | "idiom" : "ipad", 13 | "minimum-system-version" : "7.0", 14 | "extent" : "full-screen", 15 | "scale" : "1x" 16 | }, 17 | { 18 | "orientation" : "landscape", 19 | "idiom" : "ipad", 20 | "minimum-system-version" : "7.0", 21 | "extent" : "full-screen", 22 | "scale" : "2x" 23 | }, 24 | { 25 | "orientation" : "portrait", 26 | "idiom" : "iphone", 27 | "minimum-system-version" : "7.0", 28 | "scale" : "2x" 29 | }, 30 | { 31 | "orientation" : "portrait", 32 | "idiom" : "iphone", 33 | "minimum-system-version" : "7.0", 34 | "subtype" : "retina4", 35 | "scale" : "2x" 36 | }, 37 | { 38 | "orientation" : "portrait", 39 | "idiom" : "ipad", 40 | "minimum-system-version" : "7.0", 41 | "extent" : "full-screen", 42 | "scale" : "1x" 43 | } 44 | ], 45 | "info" : { 46 | "version" : 1, 47 | "author" : "xcode" 48 | } 49 | } -------------------------------------------------------------------------------- /ARAlertControllerExample/ARAlertControllerExample/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 | } -------------------------------------------------------------------------------- /ARAlertControllerExample/ARAlertControllerExample/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | com.alexruperez.$(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 | UIMainStoryboardFile 26 | Main 27 | UIRequiredDeviceCapabilities 28 | 29 | armv7 30 | 31 | UISupportedInterfaceOrientations 32 | 33 | UIInterfaceOrientationPortrait 34 | UIInterfaceOrientationLandscapeLeft 35 | UIInterfaceOrientationLandscapeRight 36 | 37 | UISupportedInterfaceOrientations~ipad 38 | 39 | UIInterfaceOrientationPortrait 40 | UIInterfaceOrientationPortraitUpsideDown 41 | UIInterfaceOrientationLandscapeLeft 42 | UIInterfaceOrientationLandscapeRight 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /ARAlertControllerExample/ARAlertControllerExample/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // ARAlertControllerExample 4 | // 5 | // Created by alexruperez on 14/2/15. 6 | // Copyright (c) 2015 alexruperez. 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 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ARAlertController 2 | 3 | [![Join the chat at https://gitter.im/alexruperez/ARAlertController](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/alexruperez/ARAlertController?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) 4 | [![Twitter](http://img.shields.io/badge/contact-@alexruperez-blue.svg?style=flat)](http://twitter.com/alexruperez) 5 | [![GitHub Issues](http://img.shields.io/github/issues/alexruperez/ARAlertController.svg?style=flat)](http://github.com/alexruperez/ARAlertController/issues) 6 | [![CI Status](http://img.shields.io/travis/alexruperez/ARAlertController.svg?style=flat)](https://travis-ci.org/alexruperez/ARAlertController) 7 | [![Version](https://img.shields.io/cocoapods/v/ARAlertController.svg?style=flat)](http://cocoadocs.org/docsets/ARAlertController) 8 | [![License](https://img.shields.io/cocoapods/l/ARAlertController.svg?style=flat)](http://cocoadocs.org/docsets/ARAlertController) 9 | [![Platform](https://img.shields.io/cocoapods/p/ARAlertController.svg?style=flat)](http://cocoadocs.org/docsets/ARAlertController) 10 | [![Dependency Status](https://www.versioneye.com/user/projects/555b0450634daa30fb0001f5/badge.svg?style=flat)](https://www.versioneye.com/user/projects/555b0450634daa30fb0001f5) 11 | [![Analytics](https://ga-beacon.appspot.com/UA-55329295-1/ARAlertController/readme?pixel)](https://github.com/igrigorik/ga-beacon) 12 | 13 | ## Overview 14 | 15 | UIAlertController compatible iOS >= 5.0 16 | 17 | #### iOS >= 8 18 | ![ARAlertController iOS8 Alert](https://raw.githubusercontent.com/alexruperez/ARAlertController/master/alert8.png) ![ARAlertController iOS8 ActionSheet](https://raw.githubusercontent.com/alexruperez/ARAlertController/master/sheet8.png) 19 | 20 | #### iOS <= 7 21 | ![ARAlertController iOS7 Alert](https://raw.githubusercontent.com/alexruperez/ARAlertController/master/alert7.png) ![ARAlertController iOS7 ActionSheet](https://raw.githubusercontent.com/alexruperez/ARAlertController/master/sheet7.png) 22 | 23 | ## Usage 24 | 25 | ### Installation 26 | 27 | ARAlertController is available through [CocoaPods](http://cocoapods.org). To install 28 | it, simply add the following line to your Podfile: 29 | 30 | pod 'ARAlertController' 31 | 32 | #### Or you can add the following files to your project: 33 | * `ARAlertController.m` 34 | * `ARAlertController.h` 35 | 36 | To run the example project, clone the repo, and run `pod install` from the Example directory first. 37 | 38 | ### Example 39 | 40 | ```objectivec 41 | ARAlertController *alert = [ARAlertController alertControllerWithTitle:@"My Alert" message:@"This is an alert." preferredStyle:ARAlertControllerStyleAlert]; 42 | 43 | ARAlertAction* defaultAction = [ARAlertAction actionWithTitle:@"OK" style:ARAlertActionStyleDefault handler:^(ARAlertAction * action) {}]; 44 | 45 | [alert addAction:defaultAction]; 46 | 47 | [alert presentInViewController:self animated:YES completion:nil]; 48 | ``` 49 | 50 | # Etc. 51 | 52 | * Contributions are very welcome. 53 | * Attribution is appreciated (let's spread the word!), but not mandatory. 54 | 55 | ## Use it? Love/hate it? 56 | 57 | Tweet the author [@alexruperez](http://twitter.com/alexruperez), and check out alexruperez's blog: http://alexruperez.com 58 | 59 | ## License 60 | 61 | ARAlertController is available under the MIT license. See the LICENSE file for more info. 62 | -------------------------------------------------------------------------------- /ARAlertControllerExample/ARAlertControllerExample/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 33 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | -------------------------------------------------------------------------------- /ARAlertController.xcodeproj/xcshareddata/xcschemes/ARAlertController.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 | 76 | 82 | 83 | 84 | 85 | 86 | 87 | 93 | 94 | 100 | 101 | 102 | 103 | 105 | 106 | 109 | 110 | 111 | -------------------------------------------------------------------------------- /ARAlertControllerExample/ARAlertControllerExample/ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.m 3 | // ARAlertControllerExample 4 | // 5 | // Created by alexruperez on 14/2/15. 6 | // Copyright (c) 2015 alexruperez. All rights reserved. 7 | // 8 | 9 | #import "ViewController.h" 10 | 11 | #import 12 | 13 | 14 | @implementation ViewController 15 | 16 | - (void)viewDidAppear:(BOOL)animated 17 | { 18 | [super viewDidAppear:animated]; 19 | 20 | [self showAlert]; 21 | } 22 | 23 | - (IBAction)showAlert 24 | { 25 | NSString *versionString = UIDevice.currentDevice.systemVersion; 26 | 27 | ARAlertController* alert = [ARAlertController alertControllerWithTitle:@"My Alert" 28 | message:[NSString stringWithFormat:@"This is an alert on iOS %@", versionString] 29 | preferredStyle:ARAlertControllerStyleAlert]; 30 | 31 | [alert addTextFieldWithConfigurationHandler:^(UITextField *textField) { 32 | textField.placeholder = @"First"; 33 | }]; 34 | 35 | [alert addTextFieldWithConfigurationHandler:^(UITextField *textField) { 36 | textField.placeholder = @"Second"; 37 | }]; 38 | 39 | [alert addTextFieldWithConfigurationHandler:^(UITextField *textField) { 40 | textField.placeholder = @"Third"; 41 | }]; 42 | 43 | ARAlertAction* defaultAction = [ARAlertAction actionWithTitle:@"OK" style:ARAlertActionStyleDefault 44 | handler:^(ARAlertAction *action) { 45 | [self logTextFields:alert.textFields action:action]; 46 | }]; 47 | 48 | [alert addAction:defaultAction]; 49 | 50 | ARAlertAction* cancelAction = [ARAlertAction actionWithTitle:@"Cancel" style:ARAlertActionStyleCancel 51 | handler:^(ARAlertAction *action) { 52 | [self logTextFields:alert.textFields action:action]; 53 | }]; 54 | 55 | [alert addAction:cancelAction]; 56 | 57 | ARAlertAction* destroyAction = [ARAlertAction actionWithTitle:@"Destroy" style:ARAlertActionStyleDestructive 58 | handler:^(ARAlertAction *action) { 59 | [self logTextFields:alert.textFields action:action]; 60 | }]; 61 | 62 | [alert addAction:destroyAction]; 63 | 64 | ARAlertAction* destroyActionExtra = [ARAlertAction actionWithTitle:@"Destroy Extra" style:ARAlertActionStyleDestructive 65 | handler:^(ARAlertAction *action) { 66 | [self logTextFields:alert.textFields action:action]; 67 | }]; 68 | 69 | [alert addAction:destroyActionExtra]; 70 | 71 | [alert presentInViewController:self animated:YES completion:nil]; 72 | } 73 | 74 | - (IBAction)showActionSheet 75 | { 76 | NSString *versionString = UIDevice.currentDevice.systemVersion; 77 | 78 | ARAlertController* actionSheet = [ARAlertController alertControllerWithTitle:@"My Alert" 79 | message:[NSString stringWithFormat:@"This is an alert on iOS %@", versionString] 80 | preferredStyle:ARAlertControllerStyleActionSheet]; 81 | 82 | ARAlertAction* defaultAction = [ARAlertAction actionWithTitle:@"OK" style:ARAlertActionStyleDefault 83 | handler:^(ARAlertAction *action) { 84 | [self logTextFields:actionSheet.textFields action:action]; 85 | }]; 86 | 87 | [actionSheet addAction:defaultAction]; 88 | 89 | ARAlertAction* cancelAction = [ARAlertAction actionWithTitle:@"Cancel" style:ARAlertActionStyleCancel 90 | handler:^(ARAlertAction *action) { 91 | [self logTextFields:actionSheet.textFields action:action]; 92 | }]; 93 | 94 | [actionSheet addAction:cancelAction]; 95 | 96 | ARAlertAction* destroyAction = [ARAlertAction actionWithTitle:@"Destroy" style:ARAlertActionStyleDestructive 97 | handler:^(ARAlertAction *action) { 98 | [self logTextFields:actionSheet.textFields action:action]; 99 | }]; 100 | 101 | [actionSheet addAction:destroyAction]; 102 | 103 | ARAlertAction* destroyActionExtra = [ARAlertAction actionWithTitle:@"Destroy Extra" style:ARAlertActionStyleDestructive 104 | handler:^(ARAlertAction *action) { 105 | [self logTextFields:actionSheet.textFields action:action]; 106 | }]; 107 | 108 | [actionSheet addAction:destroyActionExtra]; 109 | 110 | [actionSheet presentInViewController:self animated:YES completion:nil]; 111 | } 112 | 113 | - (void)logTextFields:(NSArray *)textFields action:(ARAlertAction *)action 114 | { 115 | NSLog(@"========================="); 116 | NSLog(@"Action Title: %@", action.title); 117 | for (UITextField *textField in textFields) 118 | { 119 | NSLog(@"%@ UITextField Text: %@", textField.placeholder, textField.text.length ? textField.text : 0); 120 | } 121 | NSLog(@"========================="); 122 | } 123 | 124 | @end 125 | -------------------------------------------------------------------------------- /ARAlertController/ARAlertController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ARAlertController.h 3 | // ARAlertController 4 | // 5 | // Created by alexruperez on 14/2/15. 6 | // Copyright (c) 2015 alexruperez. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | 12 | //! Project version number for ARAlertController. 13 | FOUNDATION_EXPORT double ARAlertControllerVersionNumber; 14 | 15 | //! Project version string for ARAlertController. 16 | FOUNDATION_EXPORT const unsigned char ARAlertControllerVersionString[]; 17 | 18 | /** 19 | * Alert Action Style 20 | */ 21 | typedef NS_ENUM(NSInteger, ARAlertActionStyle){ 22 | /** 23 | * Default Style 24 | */ 25 | ARAlertActionStyleDefault = 0, 26 | /** 27 | * Cancel Style 28 | */ 29 | ARAlertActionStyleCancel, 30 | /** 31 | * Destructive Style 32 | */ 33 | ARAlertActionStyleDestructive 34 | }; 35 | 36 | /** 37 | * Alert Controller Style 38 | */ 39 | typedef NS_ENUM(NSInteger, ARAlertControllerStyle){ 40 | /** 41 | * Action Sheet Style 42 | */ 43 | ARAlertControllerStyleActionSheet = 0, 44 | /** 45 | * Alert Style 46 | */ 47 | ARAlertControllerStyleAlert 48 | }; 49 | 50 | 51 | @class ARAlertAction; 52 | 53 | /** 54 | * Alert Action Handler Block 55 | * 56 | * @param action Alert Action 57 | */ 58 | typedef void (^ARAlertActionHandler)(ARAlertAction *action); 59 | 60 | /** 61 | * Alert Controller Text Field Configuration Handler 62 | * 63 | * @param textField Text Field 64 | */ 65 | typedef void (^ARAlertControllerConfigurationHandler)(UITextField *textField); 66 | 67 | #pragma mark - ARAlertAction 68 | 69 | /** 70 | * A ARAlertAction object represents an action that can be taken when tapping a button in an alert. You use this class to configure information about a single action, including the title to display in the button, any styling information, and a handler to execute when the user taps the button. After creating an alert action object, add it to a ARAlertController object before displaying the corresponding alert to the user. 71 | */ 72 | @interface ARAlertAction : NSObject 73 | 74 | #pragma mark - Initializers 75 | 76 | /** 77 | * Create and return an action with the specified title and behavior. 78 | Actions are enabled by default when you create them. 79 | * 80 | * @param title The text to use for the button title. The value you specify should be localized for the user’s current language. This parameter must not be nil. 81 | * @param style Additional styling information to apply to the button. Use the style information to convey the type of action that is performed by the button. For a list of possible values, see the constants in ARAlertActionStyle. 82 | * @param handler A ARAlertActionHandler block to execute when the user selects the action. This block has no return value and takes the selected action object as its only parameter. 83 | * 84 | * @return A new alert action object. 85 | */ 86 | + (instancetype)actionWithTitle:(NSString *)title style:(ARAlertActionStyle)style handler:(ARAlertActionHandler)handler; 87 | 88 | #pragma mark - Helpers 89 | 90 | + (instancetype)actionWithTitle:(NSString *)title style:(ARAlertActionStyle)style; 91 | 92 | + (instancetype)defaultActionWithTitle:(NSString *)title handler:(ARAlertActionHandler)handler; 93 | 94 | + (instancetype)cancelActionWithTitle:(NSString *)title handler:(ARAlertActionHandler)handler; 95 | 96 | + (instancetype)destructiveActionWithTitle:(NSString *)title handler:(ARAlertActionHandler)handler; 97 | 98 | + (instancetype)defaultActionWithTitle:(NSString *)title; 99 | 100 | + (instancetype)cancelActionWithTitle:(NSString *)title; 101 | 102 | + (instancetype)destructiveActionWithTitle:(NSString *)title; 103 | 104 | #pragma mark - Properties 105 | 106 | /** 107 | * The title of the action’s button. (read-only) 108 | */ 109 | @property (nonatomic, readonly) NSString *title; 110 | 111 | /** 112 | * The style (ARAlertActionStyle) that is applied to the action’s button. (read-only) 113 | */ 114 | @property (nonatomic, readonly) ARAlertActionStyle style; 115 | 116 | /** 117 | * A Boolean value indicating whether the action is currently enabled. 118 | */ 119 | @property (nonatomic, getter=isEnabled) BOOL enabled; 120 | 121 | @end 122 | 123 | #pragma mark - ARAlertController 124 | 125 | /** 126 | * A ARAlertController object displays an alert message to the user. This class replaces the UIActionSheet and UIAlertView classes for displaying alerts. After configuring the alert controller with the actions and style you want, present it using the presentInViewController:animated:completion: method 127 | */ 128 | @interface ARAlertController : NSObject 129 | 130 | #pragma mark - Initializers 131 | 132 | /** 133 | * Creates and returns a view controller for displaying an alert to the user. 134 | After creating the alert controller, configure any actions that you want the user to be able to perform by calling the addAction: method one or more times. When specifying a preferred style of ARAlertControllerStyleAlert, you may also configure one or more text fields to display in addition to the actions. 135 | * 136 | * @param title The title of the alert. Use this string to get the user’s attention and communicate the reason for the alert. 137 | * @param message Descriptive text that provides additional details about the reason for the alert. 138 | * @param preferredStyle The ARAlertControllerStyle style to use when presenting the alert controller. Use this parameter to configure the alert controller as an action sheet or as a modal alert. 139 | * 140 | * @return An initialized alert controller object. 141 | */ 142 | + (instancetype)alertControllerWithTitle:(NSString *)title message:(NSString *)message preferredStyle:(ARAlertControllerStyle)preferredStyle; 143 | 144 | #pragma mark - Helpers 145 | 146 | + (instancetype)alertControllerWithTitle:(NSString *)title message:(NSString *)message preferredStyle:(ARAlertControllerStyle)preferredStyle actions:(NSArray *)actions; 147 | 148 | + (instancetype)alertControllerWithTitle:(NSString *)title message:(NSString *)message preferredStyle:(ARAlertControllerStyle)preferredStyle actions:(NSArray *)actions textFieldConfigurationHandlers:(NSArray *)configurationHandlers; 149 | 150 | + (instancetype)actionSheetWithTitle:(NSString *)title message:(NSString *)message; 151 | 152 | + (instancetype)actionSheetWithTitle:(NSString *)title message:(NSString *)message actions:(NSArray *)actions; 153 | 154 | + (instancetype)alertWithTitle:(NSString *)title message:(NSString *)message; 155 | 156 | + (instancetype)alertWithTitle:(NSString *)title message:(NSString *)message actions:(NSArray *)actions; 157 | 158 | + (instancetype)alertWithTitle:(NSString *)title message:(NSString *)message actions:(NSArray *)actions textFieldConfigurationHandlers:(NSArray *)configurationHandlers; 159 | 160 | #pragma mark - Properties 161 | 162 | /** 163 | * The actions that the user can take in response to the alert or action sheet. (read-only) 164 | The actions are in the order in which you added them to the alert controller. This order also corresponds to the order in which they are displayed in the alert or action sheet. The second action in the array is displayed below the first, the third is displayed below the second, and so on. 165 | */ 166 | @property (nonatomic, readonly) NSArray *actions; 167 | 168 | /** 169 | * The array of text fields displayed by the alert. (read-only) 170 | */ 171 | @property (nonatomic, readonly) NSArray *textFields; 172 | 173 | /** 174 | * The title of the alert. 175 | */ 176 | @property (nonatomic, copy) NSString *title; 177 | 178 | /** 179 | * Descriptive text that provides more details about the reason for the alert. 180 | */ 181 | @property (nonatomic, copy) NSString *message; 182 | 183 | /** 184 | * The ARAlertControllerStyle style of the alert controller. (read-only) 185 | The value of this property is set to the value you specified in the alertControllerWithTitle:message:preferredStyle: method. This value determines how the alert is displayed onscreen. 186 | */ 187 | @property (nonatomic, readonly) ARAlertControllerStyle preferredStyle; 188 | 189 | #pragma mark - Configuration Methods 190 | 191 | /** 192 | * Attaches an action object to the alert or action sheet. 193 | If your alert has multiple actions, the order in which you add those actions determines their order in the resulting alert or action sheet. 194 | * 195 | * @param action The action object to display as part of the alert. Actions are displayed as buttons in the alert. The action object provides the button text and the action to be performed when that button is tapped. 196 | */ 197 | - (void)addAction:(ARAlertAction *)action; 198 | 199 | /** 200 | * Adds a text field to an alert. 201 | Calling this method adds an editable text field to the alert. You can call this method more than once to add additional text fields. The text fields are stacked in the resulting alert. 202 | You can add a text field only if the preferredStyle property is set to ARAlertControllerStyleAlert. 203 | * 204 | * @param configurationHandler An ARAlertControllerConfigurationHandler block for configuring the text field prior to displaying the alert. This block has no return value and takes a single parameter corresponding to the text field object. Use that parameter to change the text field properties. 205 | */ 206 | - (void)addTextFieldWithConfigurationHandler:(ARAlertControllerConfigurationHandler)configurationHandler; 207 | 208 | #pragma mark - Presentation Methods 209 | 210 | /** 211 | * Present the alert. 212 | * 213 | * @param viewController The view controller to display the alert. 214 | * @param animated Pass YES to animate the presentation; otherwise, pass NO. 215 | * @param completion The block to execute after the presentation finishes. This block has no return value and takes no parameters. You may specify nil for this parameter. 216 | */ 217 | - (void)presentInViewController:(UIViewController *)viewController animated:(BOOL)animated completion:(void (^)(void))completion; 218 | 219 | /** 220 | * Dismiss the alert. 221 | * 222 | * @param animated Pass YES to animate the presentation; otherwise, pass NO. 223 | * @param completion The block to execute after the view controller is dismissed. This block has no return value and takes no parameters. You may specify nil for this parameter. 224 | */ 225 | - (void)dismissAnimated:(BOOL)animated completion:(void (^)(void))completion; 226 | 227 | @end 228 | -------------------------------------------------------------------------------- /ARAlertController.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | D5E13A681A8F737B00C9A5F2 /* ARAlertController.h in Headers */ = {isa = PBXBuildFile; fileRef = D5E13A671A8F737B00C9A5F2 /* ARAlertController.h */; settings = {ATTRIBUTES = (Public, ); }; }; 11 | D5E13A6E1A8F737C00C9A5F2 /* ARAlertController.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D5E13A621A8F737B00C9A5F2 /* ARAlertController.framework */; }; 12 | D5E13A751A8F737C00C9A5F2 /* ARAlertControllerTests.m in Sources */ = {isa = PBXBuildFile; fileRef = D5E13A741A8F737C00C9A5F2 /* ARAlertControllerTests.m */; }; 13 | D5E13A7F1A8F73B800C9A5F2 /* ARAlertController.m in Sources */ = {isa = PBXBuildFile; fileRef = D5E13A7E1A8F73B800C9A5F2 /* ARAlertController.m */; }; 14 | /* End PBXBuildFile section */ 15 | 16 | /* Begin PBXContainerItemProxy section */ 17 | D5E13A6F1A8F737C00C9A5F2 /* PBXContainerItemProxy */ = { 18 | isa = PBXContainerItemProxy; 19 | containerPortal = D5E13A591A8F737B00C9A5F2 /* Project object */; 20 | proxyType = 1; 21 | remoteGlobalIDString = D5E13A611A8F737B00C9A5F2; 22 | remoteInfo = ARAlertController; 23 | }; 24 | /* End PBXContainerItemProxy section */ 25 | 26 | /* Begin PBXFileReference section */ 27 | D5E13A621A8F737B00C9A5F2 /* ARAlertController.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = ARAlertController.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 28 | D5E13A661A8F737B00C9A5F2 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 29 | D5E13A671A8F737B00C9A5F2 /* ARAlertController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ARAlertController.h; sourceTree = ""; }; 30 | D5E13A6D1A8F737C00C9A5F2 /* ARAlertControllerTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = ARAlertControllerTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 31 | D5E13A731A8F737C00C9A5F2 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 32 | D5E13A741A8F737C00C9A5F2 /* ARAlertControllerTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ARAlertControllerTests.m; sourceTree = ""; }; 33 | D5E13A7E1A8F73B800C9A5F2 /* ARAlertController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ARAlertController.m; sourceTree = ""; }; 34 | /* End PBXFileReference section */ 35 | 36 | /* Begin PBXFrameworksBuildPhase section */ 37 | D5E13A5E1A8F737B00C9A5F2 /* Frameworks */ = { 38 | isa = PBXFrameworksBuildPhase; 39 | buildActionMask = 2147483647; 40 | files = ( 41 | ); 42 | runOnlyForDeploymentPostprocessing = 0; 43 | }; 44 | D5E13A6A1A8F737C00C9A5F2 /* Frameworks */ = { 45 | isa = PBXFrameworksBuildPhase; 46 | buildActionMask = 2147483647; 47 | files = ( 48 | D5E13A6E1A8F737C00C9A5F2 /* ARAlertController.framework in Frameworks */, 49 | ); 50 | runOnlyForDeploymentPostprocessing = 0; 51 | }; 52 | /* End PBXFrameworksBuildPhase section */ 53 | 54 | /* Begin PBXGroup section */ 55 | D5E13A581A8F737B00C9A5F2 = { 56 | isa = PBXGroup; 57 | children = ( 58 | D5E13A641A8F737B00C9A5F2 /* ARAlertController */, 59 | D5E13A711A8F737C00C9A5F2 /* ARAlertControllerTests */, 60 | D5E13A631A8F737B00C9A5F2 /* Products */, 61 | ); 62 | sourceTree = ""; 63 | }; 64 | D5E13A631A8F737B00C9A5F2 /* Products */ = { 65 | isa = PBXGroup; 66 | children = ( 67 | D5E13A621A8F737B00C9A5F2 /* ARAlertController.framework */, 68 | D5E13A6D1A8F737C00C9A5F2 /* ARAlertControllerTests.xctest */, 69 | ); 70 | name = Products; 71 | sourceTree = ""; 72 | }; 73 | D5E13A641A8F737B00C9A5F2 /* ARAlertController */ = { 74 | isa = PBXGroup; 75 | children = ( 76 | D5E13A671A8F737B00C9A5F2 /* ARAlertController.h */, 77 | D5E13A7E1A8F73B800C9A5F2 /* ARAlertController.m */, 78 | D5E13A651A8F737B00C9A5F2 /* Supporting Files */, 79 | ); 80 | path = ARAlertController; 81 | sourceTree = ""; 82 | }; 83 | D5E13A651A8F737B00C9A5F2 /* Supporting Files */ = { 84 | isa = PBXGroup; 85 | children = ( 86 | D5E13A661A8F737B00C9A5F2 /* Info.plist */, 87 | ); 88 | name = "Supporting Files"; 89 | sourceTree = ""; 90 | }; 91 | D5E13A711A8F737C00C9A5F2 /* ARAlertControllerTests */ = { 92 | isa = PBXGroup; 93 | children = ( 94 | D5E13A741A8F737C00C9A5F2 /* ARAlertControllerTests.m */, 95 | D5E13A721A8F737C00C9A5F2 /* Supporting Files */, 96 | ); 97 | path = ARAlertControllerTests; 98 | sourceTree = ""; 99 | }; 100 | D5E13A721A8F737C00C9A5F2 /* Supporting Files */ = { 101 | isa = PBXGroup; 102 | children = ( 103 | D5E13A731A8F737C00C9A5F2 /* Info.plist */, 104 | ); 105 | name = "Supporting Files"; 106 | sourceTree = ""; 107 | }; 108 | /* End PBXGroup section */ 109 | 110 | /* Begin PBXHeadersBuildPhase section */ 111 | D5E13A5F1A8F737B00C9A5F2 /* Headers */ = { 112 | isa = PBXHeadersBuildPhase; 113 | buildActionMask = 2147483647; 114 | files = ( 115 | D5E13A681A8F737B00C9A5F2 /* ARAlertController.h in Headers */, 116 | ); 117 | runOnlyForDeploymentPostprocessing = 0; 118 | }; 119 | /* End PBXHeadersBuildPhase section */ 120 | 121 | /* Begin PBXNativeTarget section */ 122 | D5E13A611A8F737B00C9A5F2 /* ARAlertController */ = { 123 | isa = PBXNativeTarget; 124 | buildConfigurationList = D5E13A781A8F737C00C9A5F2 /* Build configuration list for PBXNativeTarget "ARAlertController" */; 125 | buildPhases = ( 126 | D5E13A5D1A8F737B00C9A5F2 /* Sources */, 127 | D5E13A5E1A8F737B00C9A5F2 /* Frameworks */, 128 | D5E13A5F1A8F737B00C9A5F2 /* Headers */, 129 | D5E13A601A8F737B00C9A5F2 /* Resources */, 130 | ); 131 | buildRules = ( 132 | ); 133 | dependencies = ( 134 | ); 135 | name = ARAlertController; 136 | productName = ARAlertController; 137 | productReference = D5E13A621A8F737B00C9A5F2 /* ARAlertController.framework */; 138 | productType = "com.apple.product-type.framework"; 139 | }; 140 | D5E13A6C1A8F737C00C9A5F2 /* ARAlertControllerTests */ = { 141 | isa = PBXNativeTarget; 142 | buildConfigurationList = D5E13A7B1A8F737C00C9A5F2 /* Build configuration list for PBXNativeTarget "ARAlertControllerTests" */; 143 | buildPhases = ( 144 | D5E13A691A8F737C00C9A5F2 /* Sources */, 145 | D5E13A6A1A8F737C00C9A5F2 /* Frameworks */, 146 | D5E13A6B1A8F737C00C9A5F2 /* Resources */, 147 | ); 148 | buildRules = ( 149 | ); 150 | dependencies = ( 151 | D5E13A701A8F737C00C9A5F2 /* PBXTargetDependency */, 152 | ); 153 | name = ARAlertControllerTests; 154 | productName = ARAlertControllerTests; 155 | productReference = D5E13A6D1A8F737C00C9A5F2 /* ARAlertControllerTests.xctest */; 156 | productType = "com.apple.product-type.bundle.unit-test"; 157 | }; 158 | /* End PBXNativeTarget section */ 159 | 160 | /* Begin PBXProject section */ 161 | D5E13A591A8F737B00C9A5F2 /* Project object */ = { 162 | isa = PBXProject; 163 | attributes = { 164 | LastUpgradeCheck = 0610; 165 | ORGANIZATIONNAME = alexruperez; 166 | TargetAttributes = { 167 | D5E13A611A8F737B00C9A5F2 = { 168 | CreatedOnToolsVersion = 6.1.1; 169 | }; 170 | D5E13A6C1A8F737C00C9A5F2 = { 171 | CreatedOnToolsVersion = 6.1.1; 172 | }; 173 | }; 174 | }; 175 | buildConfigurationList = D5E13A5C1A8F737B00C9A5F2 /* Build configuration list for PBXProject "ARAlertController" */; 176 | compatibilityVersion = "Xcode 3.2"; 177 | developmentRegion = English; 178 | hasScannedForEncodings = 0; 179 | knownRegions = ( 180 | en, 181 | ); 182 | mainGroup = D5E13A581A8F737B00C9A5F2; 183 | productRefGroup = D5E13A631A8F737B00C9A5F2 /* Products */; 184 | projectDirPath = ""; 185 | projectRoot = ""; 186 | targets = ( 187 | D5E13A611A8F737B00C9A5F2 /* ARAlertController */, 188 | D5E13A6C1A8F737C00C9A5F2 /* ARAlertControllerTests */, 189 | ); 190 | }; 191 | /* End PBXProject section */ 192 | 193 | /* Begin PBXResourcesBuildPhase section */ 194 | D5E13A601A8F737B00C9A5F2 /* Resources */ = { 195 | isa = PBXResourcesBuildPhase; 196 | buildActionMask = 2147483647; 197 | files = ( 198 | ); 199 | runOnlyForDeploymentPostprocessing = 0; 200 | }; 201 | D5E13A6B1A8F737C00C9A5F2 /* Resources */ = { 202 | isa = PBXResourcesBuildPhase; 203 | buildActionMask = 2147483647; 204 | files = ( 205 | ); 206 | runOnlyForDeploymentPostprocessing = 0; 207 | }; 208 | /* End PBXResourcesBuildPhase section */ 209 | 210 | /* Begin PBXSourcesBuildPhase section */ 211 | D5E13A5D1A8F737B00C9A5F2 /* Sources */ = { 212 | isa = PBXSourcesBuildPhase; 213 | buildActionMask = 2147483647; 214 | files = ( 215 | D5E13A7F1A8F73B800C9A5F2 /* ARAlertController.m in Sources */, 216 | ); 217 | runOnlyForDeploymentPostprocessing = 0; 218 | }; 219 | D5E13A691A8F737C00C9A5F2 /* Sources */ = { 220 | isa = PBXSourcesBuildPhase; 221 | buildActionMask = 2147483647; 222 | files = ( 223 | D5E13A751A8F737C00C9A5F2 /* ARAlertControllerTests.m in Sources */, 224 | ); 225 | runOnlyForDeploymentPostprocessing = 0; 226 | }; 227 | /* End PBXSourcesBuildPhase section */ 228 | 229 | /* Begin PBXTargetDependency section */ 230 | D5E13A701A8F737C00C9A5F2 /* PBXTargetDependency */ = { 231 | isa = PBXTargetDependency; 232 | target = D5E13A611A8F737B00C9A5F2 /* ARAlertController */; 233 | targetProxy = D5E13A6F1A8F737C00C9A5F2 /* PBXContainerItemProxy */; 234 | }; 235 | /* End PBXTargetDependency section */ 236 | 237 | /* Begin XCBuildConfiguration section */ 238 | D5E13A761A8F737C00C9A5F2 /* Debug */ = { 239 | isa = XCBuildConfiguration; 240 | buildSettings = { 241 | ALWAYS_SEARCH_USER_PATHS = NO; 242 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 243 | CLANG_CXX_LIBRARY = "libc++"; 244 | CLANG_ENABLE_MODULES = YES; 245 | CLANG_ENABLE_OBJC_ARC = YES; 246 | CLANG_WARN_BOOL_CONVERSION = YES; 247 | CLANG_WARN_CONSTANT_CONVERSION = YES; 248 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 249 | CLANG_WARN_EMPTY_BODY = YES; 250 | CLANG_WARN_ENUM_CONVERSION = YES; 251 | CLANG_WARN_INT_CONVERSION = YES; 252 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 253 | CLANG_WARN_UNREACHABLE_CODE = YES; 254 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 255 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 256 | COPY_PHASE_STRIP = NO; 257 | CURRENT_PROJECT_VERSION = 1; 258 | ENABLE_STRICT_OBJC_MSGSEND = YES; 259 | GCC_C_LANGUAGE_STANDARD = gnu99; 260 | GCC_DYNAMIC_NO_PIC = NO; 261 | GCC_OPTIMIZATION_LEVEL = 0; 262 | GCC_PREPROCESSOR_DEFINITIONS = ( 263 | "DEBUG=1", 264 | "$(inherited)", 265 | ); 266 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 267 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 268 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 269 | GCC_WARN_UNDECLARED_SELECTOR = YES; 270 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 271 | GCC_WARN_UNUSED_FUNCTION = YES; 272 | GCC_WARN_UNUSED_VARIABLE = YES; 273 | IPHONEOS_DEPLOYMENT_TARGET = 5.0; 274 | MTL_ENABLE_DEBUG_INFO = YES; 275 | ONLY_ACTIVE_ARCH = YES; 276 | SDKROOT = iphoneos; 277 | TARGETED_DEVICE_FAMILY = "1,2"; 278 | VERSIONING_SYSTEM = "apple-generic"; 279 | VERSION_INFO_PREFIX = ""; 280 | }; 281 | name = Debug; 282 | }; 283 | D5E13A771A8F737C00C9A5F2 /* Release */ = { 284 | isa = XCBuildConfiguration; 285 | buildSettings = { 286 | ALWAYS_SEARCH_USER_PATHS = NO; 287 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 288 | CLANG_CXX_LIBRARY = "libc++"; 289 | CLANG_ENABLE_MODULES = YES; 290 | CLANG_ENABLE_OBJC_ARC = YES; 291 | CLANG_WARN_BOOL_CONVERSION = YES; 292 | CLANG_WARN_CONSTANT_CONVERSION = YES; 293 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 294 | CLANG_WARN_EMPTY_BODY = YES; 295 | CLANG_WARN_ENUM_CONVERSION = YES; 296 | CLANG_WARN_INT_CONVERSION = YES; 297 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 298 | CLANG_WARN_UNREACHABLE_CODE = YES; 299 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 300 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 301 | COPY_PHASE_STRIP = YES; 302 | CURRENT_PROJECT_VERSION = 1; 303 | ENABLE_NS_ASSERTIONS = NO; 304 | ENABLE_STRICT_OBJC_MSGSEND = YES; 305 | GCC_C_LANGUAGE_STANDARD = gnu99; 306 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 307 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 308 | GCC_WARN_UNDECLARED_SELECTOR = YES; 309 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 310 | GCC_WARN_UNUSED_FUNCTION = YES; 311 | GCC_WARN_UNUSED_VARIABLE = YES; 312 | IPHONEOS_DEPLOYMENT_TARGET = 5.0; 313 | MTL_ENABLE_DEBUG_INFO = NO; 314 | SDKROOT = iphoneos; 315 | TARGETED_DEVICE_FAMILY = "1,2"; 316 | VALIDATE_PRODUCT = YES; 317 | VERSIONING_SYSTEM = "apple-generic"; 318 | VERSION_INFO_PREFIX = ""; 319 | }; 320 | name = Release; 321 | }; 322 | D5E13A791A8F737C00C9A5F2 /* Debug */ = { 323 | isa = XCBuildConfiguration; 324 | buildSettings = { 325 | DEFINES_MODULE = YES; 326 | DYLIB_COMPATIBILITY_VERSION = 1; 327 | DYLIB_CURRENT_VERSION = 1; 328 | DYLIB_INSTALL_NAME_BASE = "@rpath"; 329 | INFOPLIST_FILE = ARAlertController/Info.plist; 330 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; 331 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 332 | PRODUCT_NAME = "$(TARGET_NAME)"; 333 | SKIP_INSTALL = YES; 334 | }; 335 | name = Debug; 336 | }; 337 | D5E13A7A1A8F737C00C9A5F2 /* Release */ = { 338 | isa = XCBuildConfiguration; 339 | buildSettings = { 340 | DEFINES_MODULE = YES; 341 | DYLIB_COMPATIBILITY_VERSION = 1; 342 | DYLIB_CURRENT_VERSION = 1; 343 | DYLIB_INSTALL_NAME_BASE = "@rpath"; 344 | INFOPLIST_FILE = ARAlertController/Info.plist; 345 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; 346 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 347 | PRODUCT_NAME = "$(TARGET_NAME)"; 348 | SKIP_INSTALL = YES; 349 | }; 350 | name = Release; 351 | }; 352 | D5E13A7C1A8F737C00C9A5F2 /* Debug */ = { 353 | isa = XCBuildConfiguration; 354 | buildSettings = { 355 | FRAMEWORK_SEARCH_PATHS = ( 356 | "$(SDKROOT)/Developer/Library/Frameworks", 357 | "$(inherited)", 358 | ); 359 | GCC_PREPROCESSOR_DEFINITIONS = ( 360 | "DEBUG=1", 361 | "$(inherited)", 362 | ); 363 | INFOPLIST_FILE = ARAlertControllerTests/Info.plist; 364 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 365 | PRODUCT_NAME = "$(TARGET_NAME)"; 366 | }; 367 | name = Debug; 368 | }; 369 | D5E13A7D1A8F737C00C9A5F2 /* Release */ = { 370 | isa = XCBuildConfiguration; 371 | buildSettings = { 372 | FRAMEWORK_SEARCH_PATHS = ( 373 | "$(SDKROOT)/Developer/Library/Frameworks", 374 | "$(inherited)", 375 | ); 376 | INFOPLIST_FILE = ARAlertControllerTests/Info.plist; 377 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 378 | PRODUCT_NAME = "$(TARGET_NAME)"; 379 | }; 380 | name = Release; 381 | }; 382 | /* End XCBuildConfiguration section */ 383 | 384 | /* Begin XCConfigurationList section */ 385 | D5E13A5C1A8F737B00C9A5F2 /* Build configuration list for PBXProject "ARAlertController" */ = { 386 | isa = XCConfigurationList; 387 | buildConfigurations = ( 388 | D5E13A761A8F737C00C9A5F2 /* Debug */, 389 | D5E13A771A8F737C00C9A5F2 /* Release */, 390 | ); 391 | defaultConfigurationIsVisible = 0; 392 | defaultConfigurationName = Release; 393 | }; 394 | D5E13A781A8F737C00C9A5F2 /* Build configuration list for PBXNativeTarget "ARAlertController" */ = { 395 | isa = XCConfigurationList; 396 | buildConfigurations = ( 397 | D5E13A791A8F737C00C9A5F2 /* Debug */, 398 | D5E13A7A1A8F737C00C9A5F2 /* Release */, 399 | ); 400 | defaultConfigurationIsVisible = 0; 401 | defaultConfigurationName = Release; 402 | }; 403 | D5E13A7B1A8F737C00C9A5F2 /* Build configuration list for PBXNativeTarget "ARAlertControllerTests" */ = { 404 | isa = XCConfigurationList; 405 | buildConfigurations = ( 406 | D5E13A7C1A8F737C00C9A5F2 /* Debug */, 407 | D5E13A7D1A8F737C00C9A5F2 /* Release */, 408 | ); 409 | defaultConfigurationIsVisible = 0; 410 | defaultConfigurationName = Release; 411 | }; 412 | /* End XCConfigurationList section */ 413 | }; 414 | rootObject = D5E13A591A8F737B00C9A5F2 /* Project object */; 415 | } 416 | -------------------------------------------------------------------------------- /ARAlertController/ARAlertController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ARAlertController.m 3 | // ARAlertController 4 | // 5 | // Created by alexruperez on 14/2/15. 6 | // Copyright (c) 2015 alexruperez. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | #import "ARAlertController.h" 12 | 13 | 14 | #pragma mark - ARAlertControllerStorage 15 | 16 | @interface ARAlertControllerStorage : NSObject 17 | 18 | + (instancetype)sharedStorage; 19 | 20 | @property (strong, nonatomic) NSMutableArray *alertControllers; 21 | 22 | @end 23 | 24 | 25 | @implementation ARAlertControllerStorage 26 | 27 | #pragma mark - Initializers 28 | 29 | + (instancetype)sharedStorage 30 | { 31 | static id sharedInstance = nil; 32 | static dispatch_once_t onceToken; 33 | dispatch_once(&onceToken, ^{ 34 | sharedInstance = self.new; 35 | }); 36 | 37 | return sharedInstance; 38 | } 39 | 40 | #pragma mark - Properties 41 | 42 | - (NSMutableArray *)alertControllers 43 | { 44 | if (!_alertControllers) 45 | { 46 | _alertControllers = NSMutableArray.new; 47 | } 48 | 49 | return _alertControllers; 50 | } 51 | 52 | @end 53 | 54 | 55 | #pragma mark - ARAlertAction 56 | 57 | @interface ARAlertAction () 58 | 59 | @property (nonatomic, copy) ARAlertActionHandler handler; 60 | 61 | @end 62 | 63 | 64 | @implementation ARAlertAction 65 | 66 | #pragma mark - Initializers 67 | 68 | + (instancetype)actionWithTitle:(NSString *)title style:(ARAlertActionStyle)style handler:(ARAlertActionHandler)handler 69 | { 70 | return [[self alloc] initWithTitle:title style:style handler:handler]; 71 | } 72 | 73 | - (instancetype)initWithTitle:(NSString *)title style:(ARAlertActionStyle)style handler:(ARAlertActionHandler)handler 74 | { 75 | self = [super init]; 76 | 77 | if (self) 78 | { 79 | _title = title; 80 | _style = style; 81 | _handler = handler; 82 | } 83 | 84 | return self; 85 | } 86 | 87 | #pragma mark - Helpers 88 | 89 | + (instancetype)actionWithTitle:(NSString *)title style:(ARAlertActionStyle)style 90 | { 91 | return [self actionWithTitle:title style:style handler:nil]; 92 | } 93 | 94 | + (instancetype)defaultActionWithTitle:(NSString *)title handler:(ARAlertActionHandler)handler 95 | { 96 | return [self actionWithTitle:title style:ARAlertActionStyleDefault handler:handler]; 97 | } 98 | 99 | + (instancetype)cancelActionWithTitle:(NSString *)title handler:(ARAlertActionHandler)handler 100 | { 101 | return [self actionWithTitle:title style:ARAlertActionStyleCancel handler:handler]; 102 | } 103 | 104 | + (instancetype)destructiveActionWithTitle:(NSString *)title handler:(ARAlertActionHandler)handler 105 | { 106 | return [self actionWithTitle:title style:ARAlertActionStyleDestructive handler:handler]; 107 | } 108 | 109 | + (instancetype)defaultActionWithTitle:(NSString *)title 110 | { 111 | return [self defaultActionWithTitle:title handler:nil]; 112 | } 113 | 114 | + (instancetype)cancelActionWithTitle:(NSString *)title 115 | { 116 | return [self cancelActionWithTitle:title handler:nil]; 117 | } 118 | 119 | + (instancetype)destructiveActionWithTitle:(NSString *)title 120 | { 121 | return [self destructiveActionWithTitle:title handler:nil]; 122 | } 123 | 124 | #pragma mark - NSCopying 125 | 126 | - (instancetype)copyWithZone:(NSZone *)zone 127 | { 128 | return [[ARAlertAction allocWithZone:zone] initWithTitle:self.title.copy style:self.style handler:self.handler]; 129 | } 130 | 131 | @end 132 | 133 | 134 | #pragma mark - ARAlertController 135 | 136 | @interface ARAlertController () 137 | 138 | @property (nonatomic, strong) UIViewController *alertController; 139 | @property (nonatomic, strong) UIAlertView *alertView; 140 | @property (nonatomic, strong) UIActionSheet *actionSheet; 141 | 142 | @property (nonatomic, strong) NSMutableArray *mutableActions; 143 | @property (nonatomic, strong) NSMutableArray *mutableTextFields; 144 | @property (nonatomic, strong) NSMutableDictionary *configurationHandlers; 145 | 146 | @property (nonatomic, copy) void (^presentCompletion)(void); 147 | @property (nonatomic, copy) void (^dismissCompletion)(void); 148 | 149 | @end 150 | 151 | 152 | @implementation ARAlertController 153 | 154 | #pragma mark - Initializers 155 | 156 | + (instancetype)alertControllerWithTitle:(NSString *)title message:(NSString *)message preferredStyle:(ARAlertControllerStyle)preferredStyle 157 | { 158 | return [[self alloc] initWithTitle:title message:message preferredStyle:preferredStyle]; 159 | } 160 | 161 | - (instancetype)initWithTitle:(NSString *)title message:(NSString *)message preferredStyle:(ARAlertControllerStyle)preferredStyle 162 | { 163 | self = [super init]; 164 | 165 | if (self) 166 | { 167 | _title = title; 168 | _message = message; 169 | _preferredStyle = preferredStyle; 170 | 171 | _mutableActions = NSMutableArray.new; 172 | _mutableTextFields = NSMutableArray.new; 173 | _configurationHandlers = NSMutableDictionary.new; 174 | } 175 | 176 | return self; 177 | } 178 | 179 | #pragma mark - Helpers 180 | 181 | + (instancetype)alertControllerWithTitle:(NSString *)title message:(NSString *)message preferredStyle:(ARAlertControllerStyle)preferredStyle actions:(NSArray *)actions 182 | { 183 | ARAlertController *alertController = [self alertControllerWithTitle:title message:message preferredStyle:preferredStyle]; 184 | 185 | for (ARAlertAction *alertAction in actions) 186 | { 187 | if ([alertAction isKindOfClass:ARAlertAction.class]) 188 | { 189 | [alertController addAction:alertAction]; 190 | } 191 | } 192 | 193 | return alertController; 194 | } 195 | 196 | + (instancetype)alertControllerWithTitle:(NSString *)title message:(NSString *)message preferredStyle:(ARAlertControllerStyle)preferredStyle actions:(NSArray *)actions textFieldConfigurationHandlers:(NSArray *)configurationHandlers 197 | { 198 | ARAlertController *alertController = [self alertControllerWithTitle:title message:message preferredStyle:preferredStyle actions:actions]; 199 | 200 | for (ARAlertControllerConfigurationHandler configurationHandler in configurationHandlers) 201 | { 202 | [alertController addTextFieldWithConfigurationHandler:configurationHandler]; 203 | } 204 | 205 | return alertController; 206 | } 207 | 208 | + (instancetype)actionSheetWithTitle:(NSString *)title message:(NSString *)message 209 | { 210 | return [self actionSheetWithTitle:title message:message actions:nil]; 211 | } 212 | 213 | + (instancetype)actionSheetWithTitle:(NSString *)title message:(NSString *)message actions:(NSArray *)actions 214 | { 215 | return [self alertControllerWithTitle:title message:message preferredStyle:ARAlertControllerStyleActionSheet actions:actions textFieldConfigurationHandlers:nil]; 216 | } 217 | 218 | + (instancetype)alertWithTitle:(NSString *)title message:(NSString *)message 219 | { 220 | return [self alertWithTitle:title message:message actions:nil]; 221 | } 222 | 223 | + (instancetype)alertWithTitle:(NSString *)title message:(NSString *)message actions:(NSArray *)actions 224 | { 225 | return [self alertWithTitle:title message:message actions:actions textFieldConfigurationHandlers:nil]; 226 | } 227 | 228 | + (instancetype)alertWithTitle:(NSString *)title message:(NSString *)message actions:(NSArray *)actions textFieldConfigurationHandlers:(NSArray *)configurationHandlers 229 | { 230 | return [self alertControllerWithTitle:title message:message preferredStyle:ARAlertControllerStyleAlert actions:actions textFieldConfigurationHandlers:configurationHandlers]; 231 | } 232 | 233 | #pragma mark - NSCopying 234 | 235 | - (instancetype)copyWithZone:(NSZone *)zone 236 | { 237 | ARAlertController *alertController = [[ARAlertController allocWithZone:zone] initWithTitle:self.title.copy message:self.message.copy preferredStyle:self.preferredStyle]; 238 | 239 | for (ARAlertAction *alertAction in self.actions) 240 | { 241 | [alertController addAction:alertAction.copy]; 242 | } 243 | 244 | for (UITextField *textField in self.textFields) 245 | { 246 | NSString *textFieldHash = [NSString stringWithFormat:@"%ld", (unsigned long)textField.hash]; 247 | [alertController addTextFieldWithConfigurationHandler:self.configurationHandlers[textFieldHash]]; 248 | } 249 | 250 | alertController.alertController = self.alertController.copy; 251 | alertController.alertView = self.alertView.copy; 252 | alertController.actionSheet = self.actionSheet.copy; 253 | 254 | alertController.presentCompletion = self.presentCompletion; 255 | alertController.dismissCompletion = self.dismissCompletion; 256 | 257 | return alertController; 258 | } 259 | 260 | #pragma mark - Properties 261 | 262 | - (NSArray *)actions 263 | { 264 | return self.mutableActions.copy; 265 | } 266 | 267 | - (NSArray *)textFields 268 | { 269 | return self.mutableTextFields.copy; 270 | } 271 | 272 | #pragma mark - Configuration Methods 273 | 274 | - (void)addAction:(ARAlertAction *)action 275 | { 276 | NSObject *alertAction; 277 | 278 | if (NSClassFromString(@"UIAlertAction")) 279 | { 280 | alertAction = [UIAlertAction actionWithTitle:action.title style:(UIAlertActionStyle)action.style handler:^(UIAlertAction *alertAction) { 281 | if (action.handler) 282 | { 283 | [NSOperationQueue.mainQueue addOperationWithBlock:^{ 284 | action.handler(action); 285 | }]; 286 | } 287 | }]; 288 | } 289 | else 290 | { 291 | alertAction = action; 292 | } 293 | 294 | [self.mutableActions addObject:alertAction]; 295 | } 296 | 297 | - (void)addTextFieldWithConfigurationHandler:(ARAlertControllerConfigurationHandler)configurationHandler 298 | { 299 | NSAssert(self.preferredStyle == ARAlertControllerStyleAlert, @"Text fields can only be added to an alert controller of style ARAlertControllerStyleAlert"); 300 | 301 | UITextField *textField = UITextField.new; 302 | [self.mutableTextFields addObject:textField]; 303 | 304 | if (configurationHandler) 305 | { 306 | NSString *textFieldHash = [NSString stringWithFormat:@"%ld", (unsigned long)textField.hash]; 307 | [self.configurationHandlers setObject:configurationHandler forKey:textFieldHash]; 308 | } 309 | } 310 | 311 | #pragma mark - Presentation Methods 312 | 313 | - (void)presentInViewController:(UIViewController *)viewController animated:(BOOL)animated completion:(void (^)(void))completion 314 | { 315 | if (NSClassFromString(@"UIAlertController")) 316 | { 317 | self.alertController = [UIAlertController alertControllerWithTitle:self.title message:self.message preferredStyle:(UIAlertControllerStyle)self.preferredStyle]; 318 | UIAlertController *alertController = (UIAlertController *)self.alertController; 319 | 320 | for (UIAlertAction *action in self.actions) 321 | { 322 | [alertController addAction:action]; 323 | } 324 | 325 | for (UITextField *textFieldSaved in self.textFields) 326 | { 327 | [alertController addTextFieldWithConfigurationHandler:^(UITextField *textField) { 328 | [self replaceTextField:textFieldSaved withTextField:textField]; 329 | }]; 330 | } 331 | 332 | [viewController presentViewController:alertController animated:animated completion:completion]; 333 | } 334 | else 335 | { 336 | [[ARAlertControllerStorage sharedStorage].alertControllers addObject:self]; 337 | 338 | if (self.preferredStyle == ARAlertControllerStyleAlert) 339 | { 340 | self.alertView = [[UIAlertView alloc] initWithTitle:self.title message:self.message delegate:self cancelButtonTitle:nil otherButtonTitles:nil]; 341 | 342 | for (ARAlertAction *action in self.actions) 343 | { 344 | [self.alertView addButtonWithTitle:action.title]; 345 | 346 | if (self.alertView.cancelButtonIndex == -1 && action.style == ARAlertActionStyleCancel) 347 | { 348 | self.alertView.cancelButtonIndex = self.alertView.numberOfButtons-1; 349 | } 350 | 351 | action.enabled = YES; 352 | } 353 | 354 | if (self.textFields.count == 1) 355 | { 356 | UITextField *textFieldSaved = self.textFields[0]; 357 | 358 | self.alertView.alertViewStyle = UIAlertViewStylePlainTextInput; 359 | 360 | UITextField *textField = [self.alertView textFieldAtIndex:0]; 361 | 362 | [self replaceTextField:textFieldSaved withTextField:textField]; 363 | } 364 | else if (self.textFields.count > 1) 365 | { 366 | UITextField *firstTextFieldSaved = self.textFields[0]; 367 | UITextField *secondTextFieldSaved = self.textFields[1]; 368 | 369 | self.alertView.alertViewStyle = UIAlertViewStyleLoginAndPasswordInput; 370 | 371 | UITextField *firstTextField = [self.alertView textFieldAtIndex:0]; 372 | UITextField *secondTextField = [self.alertView textFieldAtIndex:1]; 373 | 374 | firstTextField.placeholder = nil; 375 | secondTextField.placeholder = nil; 376 | secondTextField.secureTextEntry = NO; 377 | 378 | [self replaceTextField:firstTextFieldSaved withTextField:firstTextField]; 379 | [self replaceTextField:secondTextFieldSaved withTextField:secondTextField]; 380 | } 381 | 382 | [self.alertView show]; 383 | } 384 | else if (self.preferredStyle == ARAlertControllerStyleActionSheet) 385 | { 386 | self.actionSheet = [[UIActionSheet alloc] initWithTitle:self.title delegate:self cancelButtonTitle:nil destructiveButtonTitle:nil otherButtonTitles:nil]; 387 | 388 | for (ARAlertAction *action in self.actions) 389 | { 390 | [self.actionSheet addButtonWithTitle:action.title]; 391 | 392 | if (self.actionSheet.cancelButtonIndex == -1 && action.style == ARAlertActionStyleCancel) 393 | { 394 | self.actionSheet.cancelButtonIndex = self.actionSheet.numberOfButtons-1; 395 | } 396 | 397 | if (self.actionSheet.destructiveButtonIndex == -1 && action.style == ARAlertActionStyleDestructive) 398 | { 399 | self.actionSheet.destructiveButtonIndex = self.actionSheet.numberOfButtons-1; 400 | } 401 | 402 | action.enabled = YES; 403 | } 404 | 405 | [self.actionSheet showInView:viewController.view]; 406 | } 407 | 408 | self.presentCompletion = completion; 409 | self.dismissCompletion = nil; 410 | } 411 | } 412 | 413 | - (void)dismissAnimated:(BOOL)animated completion:(void (^)(void))completion 414 | { 415 | if (self.alertController) 416 | { 417 | [self.alertController dismissViewControllerAnimated:animated completion:completion]; 418 | } 419 | else 420 | { 421 | if (self.alertView) 422 | { 423 | [self.alertView dismissWithClickedButtonIndex:self.alertView.cancelButtonIndex animated:animated]; 424 | } 425 | else if (self.actionSheet) 426 | { 427 | [self.actionSheet dismissWithClickedButtonIndex:self.actionSheet.cancelButtonIndex animated:animated]; 428 | } 429 | 430 | self.dismissCompletion = completion; 431 | self.presentCompletion = nil; 432 | } 433 | } 434 | 435 | #pragma mark - Delegates 436 | 437 | - (void)didPresentAlertView:(UIAlertView *)alertView 438 | { 439 | [self performPresentCompletion]; 440 | } 441 | 442 | - (void)didPresentActionSheet:(UIActionSheet *)actionSheet 443 | { 444 | [self performPresentCompletion]; 445 | } 446 | 447 | - (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex 448 | { 449 | [self performActionAtIndex:buttonIndex]; 450 | } 451 | 452 | - (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex 453 | { 454 | [self performActionAtIndex:buttonIndex]; 455 | } 456 | 457 | - (void)alertView:(UIAlertView *)alertView didDismissWithButtonIndex:(NSInteger)buttonIndex 458 | { 459 | [self performDismissCompletion]; 460 | } 461 | 462 | - (void)actionSheet:(UIActionSheet *)actionSheet didDismissWithButtonIndex:(NSInteger)buttonIndex 463 | { 464 | [self performDismissCompletion]; 465 | } 466 | 467 | #pragma mark - Private Methods 468 | 469 | - (void)performPresentCompletion 470 | { 471 | if (self.presentCompletion) 472 | { 473 | self.presentCompletion(); 474 | } 475 | } 476 | 477 | - (void)performActionAtIndex:(NSInteger)actionIndex 478 | { 479 | ARAlertAction *action = self.actions[actionIndex]; 480 | if (action.handler) 481 | { 482 | [NSOperationQueue.mainQueue addOperationWithBlock:^{ 483 | action.handler(action); 484 | }]; 485 | } 486 | } 487 | 488 | - (void)performDismissCompletion 489 | { 490 | if (self.dismissCompletion) 491 | { 492 | self.dismissCompletion(); 493 | } 494 | 495 | [[ARAlertControllerStorage sharedStorage].alertControllers removeObject:self]; 496 | } 497 | 498 | - (void)replaceTextField:(UITextField *)textFieldSaved withTextField:(UITextField *)textField 499 | { 500 | NSString *textFieldSavedHash = [NSString stringWithFormat:@"%ld", (unsigned long)textFieldSaved.hash]; 501 | ARAlertControllerConfigurationHandler handler = self.configurationHandlers[textFieldSavedHash]; 502 | 503 | if (handler) 504 | { 505 | handler(textField); 506 | 507 | [self.configurationHandlers removeObjectForKey:textFieldSavedHash]; 508 | 509 | NSString *textFieldHash = [NSString stringWithFormat:@"%ld", (unsigned long)textField.hash]; 510 | 511 | [self.configurationHandlers setObject:handler forKey:textFieldHash]; 512 | } 513 | 514 | [self.mutableTextFields replaceObjectAtIndex:[self.mutableTextFields indexOfObject:textFieldSaved] withObject:textField]; 515 | } 516 | 517 | @end 518 | 519 | -------------------------------------------------------------------------------- /ARAlertControllerExample/ARAlertControllerExample.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | D5E13A8F1A8F901900C9A5F2 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = D5E13A8E1A8F901900C9A5F2 /* main.m */; }; 11 | D5E13A921A8F901900C9A5F2 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = D5E13A911A8F901900C9A5F2 /* AppDelegate.m */; }; 12 | D5E13A951A8F901900C9A5F2 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = D5E13A941A8F901900C9A5F2 /* ViewController.m */; }; 13 | D5E13A981A8F901900C9A5F2 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = D5E13A961A8F901900C9A5F2 /* Main.storyboard */; }; 14 | D5E13A9A1A8F901900C9A5F2 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = D5E13A991A8F901900C9A5F2 /* Images.xcassets */; }; 15 | D5E13AA91A8F901A00C9A5F2 /* ARAlertControllerExampleTests.m in Sources */ = {isa = PBXBuildFile; fileRef = D5E13AA81A8F901A00C9A5F2 /* ARAlertControllerExampleTests.m */; }; 16 | D5E13AD21A8FBFBC00C9A5F2 /* libPods.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D5E13AD11A8FBFBC00C9A5F2 /* libPods.a */; }; 17 | /* End PBXBuildFile section */ 18 | 19 | /* Begin PBXContainerItemProxy section */ 20 | D5E13AA31A8F901A00C9A5F2 /* PBXContainerItemProxy */ = { 21 | isa = PBXContainerItemProxy; 22 | containerPortal = D5E13A811A8F901900C9A5F2 /* Project object */; 23 | proxyType = 1; 24 | remoteGlobalIDString = D5E13A881A8F901900C9A5F2; 25 | remoteInfo = ARAlertControllerExample; 26 | }; 27 | /* End PBXContainerItemProxy section */ 28 | 29 | /* Begin PBXFileReference section */ 30 | 3667429CCDF41BB17C09B7AE /* Pods.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = Pods.release.xcconfig; path = "Pods/Target Support Files/Pods/Pods.release.xcconfig"; sourceTree = ""; }; 31 | D5E13A891A8F901900C9A5F2 /* ARAlertControllerExample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = ARAlertControllerExample.app; sourceTree = BUILT_PRODUCTS_DIR; }; 32 | D5E13A8D1A8F901900C9A5F2 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 33 | D5E13A8E1A8F901900C9A5F2 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 34 | D5E13A901A8F901900C9A5F2 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 35 | D5E13A911A8F901900C9A5F2 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 36 | D5E13A931A8F901900C9A5F2 /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; 37 | D5E13A941A8F901900C9A5F2 /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; 38 | D5E13A971A8F901900C9A5F2 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 39 | D5E13A991A8F901900C9A5F2 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; 40 | D5E13AA21A8F901A00C9A5F2 /* ARAlertControllerExampleTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = ARAlertControllerExampleTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 41 | D5E13AA71A8F901A00C9A5F2 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 42 | D5E13AA81A8F901A00C9A5F2 /* ARAlertControllerExampleTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ARAlertControllerExampleTests.m; sourceTree = ""; }; 43 | D5E13ACA1A8FBE9200C9A5F2 /* ARAlertController.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ARAlertController.framework; path = Carthage/Build/iOS/ARAlertController.framework; sourceTree = ""; }; 44 | D5E13AD11A8FBFBC00C9A5F2 /* libPods.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libPods.a; path = "Pods/build/Debug-iphoneos/libPods.a"; sourceTree = ""; }; 45 | DCE497B24E40A57D9484090A /* libPods.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libPods.a; sourceTree = BUILT_PRODUCTS_DIR; }; 46 | FE8278DC698B6AA9DBC0D60C /* Pods.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = Pods.debug.xcconfig; path = "Pods/Target Support Files/Pods/Pods.debug.xcconfig"; sourceTree = ""; }; 47 | /* End PBXFileReference section */ 48 | 49 | /* Begin PBXFrameworksBuildPhase section */ 50 | D5E13A861A8F901900C9A5F2 /* Frameworks */ = { 51 | isa = PBXFrameworksBuildPhase; 52 | buildActionMask = 2147483647; 53 | files = ( 54 | D5E13AD21A8FBFBC00C9A5F2 /* libPods.a in Frameworks */, 55 | ); 56 | runOnlyForDeploymentPostprocessing = 0; 57 | }; 58 | D5E13A9F1A8F901A00C9A5F2 /* Frameworks */ = { 59 | isa = PBXFrameworksBuildPhase; 60 | buildActionMask = 2147483647; 61 | files = ( 62 | ); 63 | runOnlyForDeploymentPostprocessing = 0; 64 | }; 65 | /* End PBXFrameworksBuildPhase section */ 66 | 67 | /* Begin PBXGroup section */ 68 | D5E13A801A8F901900C9A5F2 = { 69 | isa = PBXGroup; 70 | children = ( 71 | D5E13A8B1A8F901900C9A5F2 /* ARAlertControllerExample */, 72 | D5E13AA51A8F901A00C9A5F2 /* ARAlertControllerExampleTests */, 73 | D5E13A8A1A8F901900C9A5F2 /* Products */, 74 | FC4B34E8536E3D267E2E4F2A /* Pods */, 75 | EEE53082E879D4708F7E53B1 /* Frameworks */, 76 | ); 77 | sourceTree = ""; 78 | }; 79 | D5E13A8A1A8F901900C9A5F2 /* Products */ = { 80 | isa = PBXGroup; 81 | children = ( 82 | D5E13A891A8F901900C9A5F2 /* ARAlertControllerExample.app */, 83 | D5E13AA21A8F901A00C9A5F2 /* ARAlertControllerExampleTests.xctest */, 84 | ); 85 | name = Products; 86 | sourceTree = ""; 87 | }; 88 | D5E13A8B1A8F901900C9A5F2 /* ARAlertControllerExample */ = { 89 | isa = PBXGroup; 90 | children = ( 91 | D5E13A901A8F901900C9A5F2 /* AppDelegate.h */, 92 | D5E13A911A8F901900C9A5F2 /* AppDelegate.m */, 93 | D5E13A931A8F901900C9A5F2 /* ViewController.h */, 94 | D5E13A941A8F901900C9A5F2 /* ViewController.m */, 95 | D5E13A961A8F901900C9A5F2 /* Main.storyboard */, 96 | D5E13A991A8F901900C9A5F2 /* Images.xcassets */, 97 | D5E13A8C1A8F901900C9A5F2 /* Supporting Files */, 98 | ); 99 | path = ARAlertControllerExample; 100 | sourceTree = ""; 101 | }; 102 | D5E13A8C1A8F901900C9A5F2 /* Supporting Files */ = { 103 | isa = PBXGroup; 104 | children = ( 105 | D5E13A8D1A8F901900C9A5F2 /* Info.plist */, 106 | D5E13A8E1A8F901900C9A5F2 /* main.m */, 107 | ); 108 | name = "Supporting Files"; 109 | sourceTree = ""; 110 | }; 111 | D5E13AA51A8F901A00C9A5F2 /* ARAlertControllerExampleTests */ = { 112 | isa = PBXGroup; 113 | children = ( 114 | D5E13AA81A8F901A00C9A5F2 /* ARAlertControllerExampleTests.m */, 115 | D5E13AA61A8F901A00C9A5F2 /* Supporting Files */, 116 | ); 117 | path = ARAlertControllerExampleTests; 118 | sourceTree = ""; 119 | }; 120 | D5E13AA61A8F901A00C9A5F2 /* Supporting Files */ = { 121 | isa = PBXGroup; 122 | children = ( 123 | D5E13AA71A8F901A00C9A5F2 /* Info.plist */, 124 | ); 125 | name = "Supporting Files"; 126 | sourceTree = ""; 127 | }; 128 | EEE53082E879D4708F7E53B1 /* Frameworks */ = { 129 | isa = PBXGroup; 130 | children = ( 131 | D5E13AD11A8FBFBC00C9A5F2 /* libPods.a */, 132 | D5E13ACA1A8FBE9200C9A5F2 /* ARAlertController.framework */, 133 | DCE497B24E40A57D9484090A /* libPods.a */, 134 | ); 135 | name = Frameworks; 136 | sourceTree = ""; 137 | }; 138 | FC4B34E8536E3D267E2E4F2A /* Pods */ = { 139 | isa = PBXGroup; 140 | children = ( 141 | FE8278DC698B6AA9DBC0D60C /* Pods.debug.xcconfig */, 142 | 3667429CCDF41BB17C09B7AE /* Pods.release.xcconfig */, 143 | ); 144 | name = Pods; 145 | sourceTree = ""; 146 | }; 147 | /* End PBXGroup section */ 148 | 149 | /* Begin PBXNativeTarget section */ 150 | D5E13A881A8F901900C9A5F2 /* ARAlertControllerExample */ = { 151 | isa = PBXNativeTarget; 152 | buildConfigurationList = D5E13AAC1A8F901A00C9A5F2 /* Build configuration list for PBXNativeTarget "ARAlertControllerExample" */; 153 | buildPhases = ( 154 | 29B472A7C6FB170CECE15A23 /* Check Pods Manifest.lock */, 155 | D5E13A851A8F901900C9A5F2 /* Sources */, 156 | D5E13A861A8F901900C9A5F2 /* Frameworks */, 157 | D5E13A871A8F901900C9A5F2 /* Resources */, 158 | 3831F04F18022C75C55E1A87 /* Copy Pods Resources */, 159 | ); 160 | buildRules = ( 161 | ); 162 | dependencies = ( 163 | ); 164 | name = ARAlertControllerExample; 165 | productName = ARAlertControllerExample; 166 | productReference = D5E13A891A8F901900C9A5F2 /* ARAlertControllerExample.app */; 167 | productType = "com.apple.product-type.application"; 168 | }; 169 | D5E13AA11A8F901A00C9A5F2 /* ARAlertControllerExampleTests */ = { 170 | isa = PBXNativeTarget; 171 | buildConfigurationList = D5E13AAF1A8F901A00C9A5F2 /* Build configuration list for PBXNativeTarget "ARAlertControllerExampleTests" */; 172 | buildPhases = ( 173 | D5E13A9E1A8F901A00C9A5F2 /* Sources */, 174 | D5E13A9F1A8F901A00C9A5F2 /* Frameworks */, 175 | D5E13AA01A8F901A00C9A5F2 /* Resources */, 176 | ); 177 | buildRules = ( 178 | ); 179 | dependencies = ( 180 | D5E13AA41A8F901A00C9A5F2 /* PBXTargetDependency */, 181 | ); 182 | name = ARAlertControllerExampleTests; 183 | productName = ARAlertControllerExampleTests; 184 | productReference = D5E13AA21A8F901A00C9A5F2 /* ARAlertControllerExampleTests.xctest */; 185 | productType = "com.apple.product-type.bundle.unit-test"; 186 | }; 187 | /* End PBXNativeTarget section */ 188 | 189 | /* Begin PBXProject section */ 190 | D5E13A811A8F901900C9A5F2 /* Project object */ = { 191 | isa = PBXProject; 192 | attributes = { 193 | LastUpgradeCheck = 0610; 194 | ORGANIZATIONNAME = alexruperez; 195 | TargetAttributes = { 196 | D5E13A881A8F901900C9A5F2 = { 197 | CreatedOnToolsVersion = 6.1.1; 198 | }; 199 | D5E13AA11A8F901A00C9A5F2 = { 200 | CreatedOnToolsVersion = 6.1.1; 201 | TestTargetID = D5E13A881A8F901900C9A5F2; 202 | }; 203 | }; 204 | }; 205 | buildConfigurationList = D5E13A841A8F901900C9A5F2 /* Build configuration list for PBXProject "ARAlertControllerExample" */; 206 | compatibilityVersion = "Xcode 3.2"; 207 | developmentRegion = English; 208 | hasScannedForEncodings = 0; 209 | knownRegions = ( 210 | en, 211 | Base, 212 | ); 213 | mainGroup = D5E13A801A8F901900C9A5F2; 214 | productRefGroup = D5E13A8A1A8F901900C9A5F2 /* Products */; 215 | projectDirPath = ""; 216 | projectRoot = ""; 217 | targets = ( 218 | D5E13A881A8F901900C9A5F2 /* ARAlertControllerExample */, 219 | D5E13AA11A8F901A00C9A5F2 /* ARAlertControllerExampleTests */, 220 | ); 221 | }; 222 | /* End PBXProject section */ 223 | 224 | /* Begin PBXResourcesBuildPhase section */ 225 | D5E13A871A8F901900C9A5F2 /* Resources */ = { 226 | isa = PBXResourcesBuildPhase; 227 | buildActionMask = 2147483647; 228 | files = ( 229 | D5E13A981A8F901900C9A5F2 /* Main.storyboard in Resources */, 230 | D5E13A9A1A8F901900C9A5F2 /* Images.xcassets in Resources */, 231 | ); 232 | runOnlyForDeploymentPostprocessing = 0; 233 | }; 234 | D5E13AA01A8F901A00C9A5F2 /* Resources */ = { 235 | isa = PBXResourcesBuildPhase; 236 | buildActionMask = 2147483647; 237 | files = ( 238 | ); 239 | runOnlyForDeploymentPostprocessing = 0; 240 | }; 241 | /* End PBXResourcesBuildPhase section */ 242 | 243 | /* Begin PBXShellScriptBuildPhase section */ 244 | 29B472A7C6FB170CECE15A23 /* Check Pods Manifest.lock */ = { 245 | isa = PBXShellScriptBuildPhase; 246 | buildActionMask = 2147483647; 247 | files = ( 248 | ); 249 | inputPaths = ( 250 | ); 251 | name = "Check Pods Manifest.lock"; 252 | outputPaths = ( 253 | ); 254 | runOnlyForDeploymentPostprocessing = 0; 255 | shellPath = /bin/sh; 256 | shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [[ $? != 0 ]] ; then\n cat << EOM\nerror: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\nEOM\n exit 1\nfi\n"; 257 | showEnvVarsInLog = 0; 258 | }; 259 | 3831F04F18022C75C55E1A87 /* Copy Pods Resources */ = { 260 | isa = PBXShellScriptBuildPhase; 261 | buildActionMask = 2147483647; 262 | files = ( 263 | ); 264 | inputPaths = ( 265 | ); 266 | name = "Copy Pods Resources"; 267 | outputPaths = ( 268 | ); 269 | runOnlyForDeploymentPostprocessing = 0; 270 | shellPath = /bin/sh; 271 | shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods/Pods-resources.sh\"\n"; 272 | showEnvVarsInLog = 0; 273 | }; 274 | /* End PBXShellScriptBuildPhase section */ 275 | 276 | /* Begin PBXSourcesBuildPhase section */ 277 | D5E13A851A8F901900C9A5F2 /* Sources */ = { 278 | isa = PBXSourcesBuildPhase; 279 | buildActionMask = 2147483647; 280 | files = ( 281 | D5E13A951A8F901900C9A5F2 /* ViewController.m in Sources */, 282 | D5E13A921A8F901900C9A5F2 /* AppDelegate.m in Sources */, 283 | D5E13A8F1A8F901900C9A5F2 /* main.m in Sources */, 284 | ); 285 | runOnlyForDeploymentPostprocessing = 0; 286 | }; 287 | D5E13A9E1A8F901A00C9A5F2 /* Sources */ = { 288 | isa = PBXSourcesBuildPhase; 289 | buildActionMask = 2147483647; 290 | files = ( 291 | D5E13AA91A8F901A00C9A5F2 /* ARAlertControllerExampleTests.m in Sources */, 292 | ); 293 | runOnlyForDeploymentPostprocessing = 0; 294 | }; 295 | /* End PBXSourcesBuildPhase section */ 296 | 297 | /* Begin PBXTargetDependency section */ 298 | D5E13AA41A8F901A00C9A5F2 /* PBXTargetDependency */ = { 299 | isa = PBXTargetDependency; 300 | target = D5E13A881A8F901900C9A5F2 /* ARAlertControllerExample */; 301 | targetProxy = D5E13AA31A8F901A00C9A5F2 /* PBXContainerItemProxy */; 302 | }; 303 | /* End PBXTargetDependency section */ 304 | 305 | /* Begin PBXVariantGroup section */ 306 | D5E13A961A8F901900C9A5F2 /* Main.storyboard */ = { 307 | isa = PBXVariantGroup; 308 | children = ( 309 | D5E13A971A8F901900C9A5F2 /* Base */, 310 | ); 311 | name = Main.storyboard; 312 | sourceTree = ""; 313 | }; 314 | /* End PBXVariantGroup section */ 315 | 316 | /* Begin XCBuildConfiguration section */ 317 | D5E13AAA1A8F901A00C9A5F2 /* Debug */ = { 318 | isa = XCBuildConfiguration; 319 | buildSettings = { 320 | ALWAYS_SEARCH_USER_PATHS = NO; 321 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 322 | CLANG_CXX_LIBRARY = "libc++"; 323 | CLANG_ENABLE_MODULES = YES; 324 | CLANG_ENABLE_OBJC_ARC = YES; 325 | CLANG_WARN_BOOL_CONVERSION = YES; 326 | CLANG_WARN_CONSTANT_CONVERSION = YES; 327 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 328 | CLANG_WARN_EMPTY_BODY = YES; 329 | CLANG_WARN_ENUM_CONVERSION = YES; 330 | CLANG_WARN_INT_CONVERSION = YES; 331 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 332 | CLANG_WARN_UNREACHABLE_CODE = YES; 333 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 334 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 335 | COPY_PHASE_STRIP = NO; 336 | ENABLE_STRICT_OBJC_MSGSEND = YES; 337 | GCC_C_LANGUAGE_STANDARD = gnu99; 338 | GCC_DYNAMIC_NO_PIC = NO; 339 | GCC_OPTIMIZATION_LEVEL = 0; 340 | GCC_PREPROCESSOR_DEFINITIONS = ( 341 | "DEBUG=1", 342 | "$(inherited)", 343 | ); 344 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 345 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 346 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 347 | GCC_WARN_UNDECLARED_SELECTOR = YES; 348 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 349 | GCC_WARN_UNUSED_FUNCTION = YES; 350 | GCC_WARN_UNUSED_VARIABLE = YES; 351 | IPHONEOS_DEPLOYMENT_TARGET = 7.0; 352 | MTL_ENABLE_DEBUG_INFO = YES; 353 | ONLY_ACTIVE_ARCH = YES; 354 | SDKROOT = iphoneos; 355 | TARGETED_DEVICE_FAMILY = "1,2"; 356 | }; 357 | name = Debug; 358 | }; 359 | D5E13AAB1A8F901A00C9A5F2 /* Release */ = { 360 | isa = XCBuildConfiguration; 361 | buildSettings = { 362 | ALWAYS_SEARCH_USER_PATHS = NO; 363 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 364 | CLANG_CXX_LIBRARY = "libc++"; 365 | CLANG_ENABLE_MODULES = YES; 366 | CLANG_ENABLE_OBJC_ARC = YES; 367 | CLANG_WARN_BOOL_CONVERSION = YES; 368 | CLANG_WARN_CONSTANT_CONVERSION = YES; 369 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 370 | CLANG_WARN_EMPTY_BODY = YES; 371 | CLANG_WARN_ENUM_CONVERSION = YES; 372 | CLANG_WARN_INT_CONVERSION = YES; 373 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 374 | CLANG_WARN_UNREACHABLE_CODE = YES; 375 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 376 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 377 | COPY_PHASE_STRIP = YES; 378 | ENABLE_NS_ASSERTIONS = NO; 379 | ENABLE_STRICT_OBJC_MSGSEND = YES; 380 | GCC_C_LANGUAGE_STANDARD = gnu99; 381 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 382 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 383 | GCC_WARN_UNDECLARED_SELECTOR = YES; 384 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 385 | GCC_WARN_UNUSED_FUNCTION = YES; 386 | GCC_WARN_UNUSED_VARIABLE = YES; 387 | IPHONEOS_DEPLOYMENT_TARGET = 7.0; 388 | MTL_ENABLE_DEBUG_INFO = NO; 389 | SDKROOT = iphoneos; 390 | TARGETED_DEVICE_FAMILY = "1,2"; 391 | VALIDATE_PRODUCT = YES; 392 | }; 393 | name = Release; 394 | }; 395 | D5E13AAD1A8F901A00C9A5F2 /* Debug */ = { 396 | isa = XCBuildConfiguration; 397 | baseConfigurationReference = FE8278DC698B6AA9DBC0D60C /* Pods.debug.xcconfig */; 398 | buildSettings = { 399 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 400 | ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; 401 | FRAMEWORK_SEARCH_PATHS = ( 402 | "$(inherited)", 403 | "$(PROJECT_DIR)/Carthage/Build/iOS", 404 | ); 405 | INFOPLIST_FILE = ARAlertControllerExample/Info.plist; 406 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 407 | LIBRARY_SEARCH_PATHS = ( 408 | "$(inherited)", 409 | "$(PROJECT_DIR)/Pods/build/Debug-iphoneos", 410 | ); 411 | PRODUCT_NAME = "$(TARGET_NAME)"; 412 | }; 413 | name = Debug; 414 | }; 415 | D5E13AAE1A8F901A00C9A5F2 /* Release */ = { 416 | isa = XCBuildConfiguration; 417 | baseConfigurationReference = 3667429CCDF41BB17C09B7AE /* Pods.release.xcconfig */; 418 | buildSettings = { 419 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 420 | ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; 421 | FRAMEWORK_SEARCH_PATHS = ( 422 | "$(inherited)", 423 | "$(PROJECT_DIR)/Carthage/Build/iOS", 424 | ); 425 | INFOPLIST_FILE = ARAlertControllerExample/Info.plist; 426 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 427 | LIBRARY_SEARCH_PATHS = ( 428 | "$(inherited)", 429 | "$(PROJECT_DIR)/Pods/build/Debug-iphoneos", 430 | ); 431 | PRODUCT_NAME = "$(TARGET_NAME)"; 432 | }; 433 | name = Release; 434 | }; 435 | D5E13AB01A8F901A00C9A5F2 /* Debug */ = { 436 | isa = XCBuildConfiguration; 437 | buildSettings = { 438 | BUNDLE_LOADER = "$(TEST_HOST)"; 439 | FRAMEWORK_SEARCH_PATHS = ( 440 | "$(SDKROOT)/Developer/Library/Frameworks", 441 | "$(inherited)", 442 | ); 443 | GCC_PREPROCESSOR_DEFINITIONS = ( 444 | "DEBUG=1", 445 | "$(inherited)", 446 | ); 447 | INFOPLIST_FILE = ARAlertControllerExampleTests/Info.plist; 448 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 449 | PRODUCT_NAME = "$(TARGET_NAME)"; 450 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/ARAlertControllerExample.app/ARAlertControllerExample"; 451 | }; 452 | name = Debug; 453 | }; 454 | D5E13AB11A8F901A00C9A5F2 /* Release */ = { 455 | isa = XCBuildConfiguration; 456 | buildSettings = { 457 | BUNDLE_LOADER = "$(TEST_HOST)"; 458 | FRAMEWORK_SEARCH_PATHS = ( 459 | "$(SDKROOT)/Developer/Library/Frameworks", 460 | "$(inherited)", 461 | ); 462 | INFOPLIST_FILE = ARAlertControllerExampleTests/Info.plist; 463 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 464 | PRODUCT_NAME = "$(TARGET_NAME)"; 465 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/ARAlertControllerExample.app/ARAlertControllerExample"; 466 | }; 467 | name = Release; 468 | }; 469 | /* End XCBuildConfiguration section */ 470 | 471 | /* Begin XCConfigurationList section */ 472 | D5E13A841A8F901900C9A5F2 /* Build configuration list for PBXProject "ARAlertControllerExample" */ = { 473 | isa = XCConfigurationList; 474 | buildConfigurations = ( 475 | D5E13AAA1A8F901A00C9A5F2 /* Debug */, 476 | D5E13AAB1A8F901A00C9A5F2 /* Release */, 477 | ); 478 | defaultConfigurationIsVisible = 0; 479 | defaultConfigurationName = Release; 480 | }; 481 | D5E13AAC1A8F901A00C9A5F2 /* Build configuration list for PBXNativeTarget "ARAlertControllerExample" */ = { 482 | isa = XCConfigurationList; 483 | buildConfigurations = ( 484 | D5E13AAD1A8F901A00C9A5F2 /* Debug */, 485 | D5E13AAE1A8F901A00C9A5F2 /* Release */, 486 | ); 487 | defaultConfigurationIsVisible = 0; 488 | defaultConfigurationName = Release; 489 | }; 490 | D5E13AAF1A8F901A00C9A5F2 /* Build configuration list for PBXNativeTarget "ARAlertControllerExampleTests" */ = { 491 | isa = XCConfigurationList; 492 | buildConfigurations = ( 493 | D5E13AB01A8F901A00C9A5F2 /* Debug */, 494 | D5E13AB11A8F901A00C9A5F2 /* Release */, 495 | ); 496 | defaultConfigurationIsVisible = 0; 497 | defaultConfigurationName = Release; 498 | }; 499 | /* End XCConfigurationList section */ 500 | }; 501 | rootObject = D5E13A811A8F901900C9A5F2 /* Project object */; 502 | } 503 | --------------------------------------------------------------------------------