├── screenshot.png ├── README.md ├── DYAlertPickerViewDemo.xcodeproj ├── project.xcworkspace │ └── contents.xcworkspacedata └── project.pbxproj ├── DYAlertPickerViewDemo-Swift ├── DYAlertPickerView-Bridging-Header.h ├── Assets.xcassets │ └── AppIcon.appiconset │ │ └── Contents.json ├── Info.plist ├── Base.lproj │ ├── LaunchScreen.storyboard │ └── Main.storyboard ├── ViewController.swift └── AppDelegate.swift ├── .gitignore ├── DYAlertPickerViewDemo ├── AppDelegate.h ├── ViewController.h ├── main.m ├── Images.xcassets │ ├── LaunchImage.launchimage │ │ └── Contents.json │ └── AppIcon.appiconset │ │ └── Contents.json ├── Info.plist ├── ViewController.m ├── AppDelegate.m ├── Base.lproj │ ├── Main.storyboard │ └── LaunchScreen.xib └── DYAlertPickerView │ ├── DYAlertPickView.h │ └── DYAlertPickView.m ├── DYAlertPickerViewDemoTests ├── Info.plist └── DYAlertPickerViewDemoTests.m └── LICENSE /screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danny-source/DYAlertPickerViewDemo/HEAD/screenshot.png -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # DYAlertPickerView 2 | 3 | AlertView with PickerView and Switch 4 | 5 | ![](https://raw.githubusercontent.com/danny-source/DYAlertPickerViewDemo/master/screenshot.png) 6 | 7 | -------------------------------------------------------------------------------- /DYAlertPickerViewDemo.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /DYAlertPickerViewDemo-Swift/DYAlertPickerView-Bridging-Header.h: -------------------------------------------------------------------------------- 1 | // 2 | // DYAlertPickerView-Bridging-Header.h 3 | // DYAlertPickerViewDemo 4 | // 5 | // Created by danny on 2016/1/7. 6 | // Copyright © 2016年 danny. All rights reserved. 7 | // 8 | #import "DYAlertPickView.h" 9 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Created by https://www.gitignore.io 2 | 3 | ### Xcode ### 4 | build/ 5 | *.pbxuser 6 | !default.pbxuser 7 | *.mode1v3 8 | !default.mode1v3 9 | *.mode2v3 10 | !default.mode2v3 11 | *.perspectivev3 12 | !default.perspectivev3 13 | xcuserdata 14 | *.xccheckout 15 | *.moved-aside 16 | DerivedData 17 | *.xcuserstate 18 | -------------------------------------------------------------------------------- /DYAlertPickerViewDemo/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // DYAlertPickerViewDemo 4 | // 5 | // Created by danny on 2015/7/7. 6 | // Copyright (c) 2015年 danny. 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 | -------------------------------------------------------------------------------- /DYAlertPickerViewDemo/ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // DYAlertPickerViewDemo 4 | // 5 | // Created by danny on 2015/7/7. 6 | // Copyright (c) 2015年 danny. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "DYAlertPickView.h" 11 | 12 | @interface ViewController : UIViewController 13 | 14 | 15 | @end 16 | 17 | -------------------------------------------------------------------------------- /DYAlertPickerViewDemo/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // DYAlertPickerViewDemo 4 | // 5 | // Created by danny on 2015/7/7. 6 | // Copyright (c) 2015年 danny. 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 | -------------------------------------------------------------------------------- /DYAlertPickerViewDemo-Swift/Assets.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 | "info" : { 35 | "version" : 1, 36 | "author" : "xcode" 37 | } 38 | } -------------------------------------------------------------------------------- /DYAlertPickerViewDemoTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 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 | -------------------------------------------------------------------------------- /DYAlertPickerViewDemoTests/DYAlertPickerViewDemoTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // DYAlertPickerViewDemoTests.m 3 | // DYAlertPickerViewDemoTests 4 | // 5 | // Created by danny on 2015/7/7. 6 | // Copyright (c) 2015年 danny. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | @interface DYAlertPickerViewDemoTests : XCTestCase 13 | 14 | @end 15 | 16 | @implementation DYAlertPickerViewDemoTests 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 Danny 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /DYAlertPickerViewDemo/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 | } -------------------------------------------------------------------------------- /DYAlertPickerViewDemo-Swift/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIMainStoryboardFile 28 | Main 29 | UIRequiredDeviceCapabilities 30 | 31 | armv7 32 | 33 | UIRequiresFullScreen 34 | 35 | UISupportedInterfaceOrientations 36 | 37 | UIInterfaceOrientationPortrait 38 | UIInterfaceOrientationPortraitUpsideDown 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /DYAlertPickerViewDemo/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 | "idiom" : "ipad", 65 | "size" : "83.5x83.5", 66 | "scale" : "2x" 67 | } 68 | ], 69 | "info" : { 70 | "version" : 1, 71 | "author" : "xcode" 72 | } 73 | } -------------------------------------------------------------------------------- /DYAlertPickerViewDemo/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.1 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 2 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIMainStoryboardFile 28 | Main 29 | UIRequiredDeviceCapabilities 30 | 31 | armv7 32 | 33 | UIRequiresFullScreen 34 | 35 | UISupportedInterfaceOrientations 36 | 37 | UIInterfaceOrientationPortrait 38 | UIInterfaceOrientationPortraitUpsideDown 39 | 40 | UISupportedInterfaceOrientations~ipad 41 | 42 | UIInterfaceOrientationPortrait 43 | UIInterfaceOrientationPortraitUpsideDown 44 | UIInterfaceOrientationLandscapeLeft 45 | UIInterfaceOrientationLandscapeRight 46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /DYAlertPickerViewDemo-Swift/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /DYAlertPickerViewDemo/ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.m 3 | // DYAlertPickerViewDemo 4 | // 5 | // Created by danny on 2015/7/7. 6 | // Copyright (c) 2015年 danny. All rights reserved. 7 | // 8 | 9 | #import "ViewController.h" 10 | 11 | @interface ViewController () 12 | 13 | @property NSArray *item; 14 | @end 15 | 16 | @implementation ViewController 17 | 18 | - (void)viewDidLoad { 19 | [super viewDidLoad]; 20 | // Do any additional setup after loading the view, typically from a nib. 21 | self.item = @[@"Item 1", @"Item 2", @"Item 3", @"Item 4", @"Item 5"]; 22 | } 23 | 24 | - (void)didReceiveMemoryWarning { 25 | [super didReceiveMemoryWarning]; 26 | // Dispose of any resources that can be recreated. 27 | } 28 | 29 | - (NSAttributedString *)pickerview:(DYAlertPickView *)pickerView 30 | titleForRow:(NSInteger)row{ 31 | NSAttributedString *str = [[NSAttributedString alloc] initWithString:self.item[row]]; 32 | return str; 33 | } 34 | - (NSInteger)numberOfRowsInPickerview:(DYAlertPickView *)pickerView { 35 | return self.item.count; 36 | } 37 | - (void)pickerview:(DYAlertPickView *)pickerView didConfirmWithItemAtRow:(NSInteger)row{ 38 | NSLog(@"%@ didConfirm", self.item[row]); 39 | } 40 | 41 | - (void)pickerviewDidClickCancelButton:(DYAlertPickView *)pickerView { 42 | NSLog(@"Canceled"); 43 | } 44 | 45 | - (void)pickerviewDidClickSwitchButton:(DYAlertPickView *)pickerView switchButton:(UISwitch *)switchButton { 46 | NSLog(@"switch:%@",(switchButton.isOn?@"On":@"Off")); 47 | } 48 | 49 | 50 | - (BOOL)pickerviewStateOfSwitchButton { 51 | return YES; 52 | } 53 | 54 | - (IBAction)showAlertPickerView:(id)sender { 55 | DYAlertPickView *picker = [[DYAlertPickView alloc] initWithHeaderTitle:@"Title" cancelButtonTitle:@"Cancel" confirmButtonTitle:@"Confirm" switchButtonTitle:@"Don't ask me"]; 56 | picker.delegate = self; 57 | picker.dataSource = self; 58 | [picker showAndSelectedIndex:3]; 59 | } 60 | @end 61 | -------------------------------------------------------------------------------- /DYAlertPickerViewDemo-Swift/ViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.swift 3 | // DYAlertPickerViewDemo-Swift 4 | // 5 | // Created by danny on 2016/1/7. 6 | // Copyright © 2016年 danny. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class ViewController: UIViewController, DYAlertPickViewDelegate, DYAlertPickViewDataSource { 12 | var items = Array() 13 | var alertView:DYAlertPickView = DYAlertPickView() 14 | override func viewDidLoad() { 15 | super.viewDidLoad() 16 | // Do any additional setup after loading the view, typically from a nib. 17 | 18 | } 19 | 20 | override func didReceiveMemoryWarning() { 21 | super.didReceiveMemoryWarning() 22 | // Dispose of any resources that can be recreated. 23 | } 24 | 25 | func pickerview(pickerView: DYAlertPickView!, titleForRow row: Int) -> NSAttributedString! { 26 | let str = NSAttributedString(string: items[row]) 27 | return str 28 | } 29 | func numberOfRowsInPickerview(pickerView: DYAlertPickView!) -> Int { 30 | return items.count 31 | } 32 | 33 | 34 | func pickerview(pickerView: DYAlertPickView!, didConfirmWithItemAtRow row: Int) { 35 | print(items[row]," didConfirm"); 36 | } 37 | 38 | func pickerviewDidClickCancelButton(pickerView: DYAlertPickView!) { 39 | print("Canceled"); 40 | } 41 | 42 | func pickerviewDidClickSwitchButton(pickerView: DYAlertPickView!, switchButton: UISwitch!) { 43 | if (switchButton.on) { 44 | print("On") 45 | }else { 46 | print("Off") 47 | } 48 | } 49 | 50 | @objc func alertpickerviewStateOfSwitchButton() -> Bool { 51 | return true; 52 | } 53 | 54 | func showAlertPickerView(sender:UIButton ) { 55 | self.alertView = DYAlertPickView(headerTitle: "Title", cancelButtonTitle: "Cancel", confirmButtonTitle: "Confirm", switchButtonTitle: "Don't ask me") 56 | self.alertView.delegate = self; 57 | self.alertView.dataSource = self; 58 | items = ["Item 1", "Item 2", "Item 3", "Item 4", "Item 5"] 59 | self.alertView.showAndSelectedIndex(3) 60 | } 61 | } 62 | 63 | -------------------------------------------------------------------------------- /DYAlertPickerViewDemo/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // DYAlertPickerViewDemo 4 | // 5 | // Created by danny on 2015/7/7. 6 | // Copyright (c) 2015年 danny. 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 | -------------------------------------------------------------------------------- /DYAlertPickerViewDemo-Swift/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // DYAlertPickerViewDemo-Swift 4 | // 5 | // Created by danny on 2016/1/7. 6 | // Copyright © 2016年 danny. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | @UIApplicationMain 12 | class AppDelegate: UIResponder, UIApplicationDelegate { 13 | 14 | var window: UIWindow? 15 | 16 | 17 | func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool { 18 | // Override point for customization after application launch. 19 | return true 20 | } 21 | 22 | func applicationWillResignActive(application: UIApplication) { 23 | // 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. 24 | // 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. 25 | } 26 | 27 | func applicationDidEnterBackground(application: UIApplication) { 28 | // 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. 29 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 30 | } 31 | 32 | func applicationWillEnterForeground(application: UIApplication) { 33 | // 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. 34 | } 35 | 36 | func applicationDidBecomeActive(application: UIApplication) { 37 | // 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. 38 | } 39 | 40 | func applicationWillTerminate(application: UIApplication) { 41 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 42 | } 43 | 44 | 45 | } 46 | 47 | -------------------------------------------------------------------------------- /DYAlertPickerViewDemo-Swift/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /DYAlertPickerViewDemo/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /DYAlertPickerViewDemo/DYAlertPickerView/DYAlertPickView.h: -------------------------------------------------------------------------------- 1 | // 2 | // DYAlerPickView.h 3 | // DYAlertPickerViewDemo 4 | // 5 | // Created by danny on 2015/7/7. 6 | // Copyright (c) 2015年 danny. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @class DYAlertPickView; 12 | 13 | @protocol DYAlertPickViewDataSource 14 | @required 15 | 16 | // 17 | - (NSAttributedString *)pickerview:(DYAlertPickView *)pickerView 18 | titleForRow:(NSInteger)row; 19 | 20 | - (NSInteger)numberOfRowsInPickerview:(DYAlertPickView *)pickerView; 21 | 22 | @end 23 | 24 | @protocol DYAlertPickViewDelegate 25 | @optional 26 | 27 | // delegate for selecting item 28 | - (void)pickerview:(DYAlertPickView *)pickerView 29 | didConfirmWithItemAtRow:(NSInteger)row; 30 | 31 | // delegate for canceling 32 | - (void)pickerviewDidClickCancelButton:(DYAlertPickView *)pickerView; 33 | 34 | // 35 | 36 | - (void)pickerviewDidClickSwitchButton:(UISwitch *)switchButton __attribute((deprecated("use DYAlertPickerViewDidClickSwitchButton:switchButton:"))); 37 | 38 | - (void)pickerviewDidClickSwitchButton:(DYAlertPickView *)pickerView switchButton:(UISwitch *)switchButton; 39 | 40 | // 41 | - (BOOL)pickerviewStateOfSwitchButton; 42 | 43 | @end 44 | 45 | @interface DYAlertPickView : UIView 46 | 47 | //tap background to dismiss 48 | @property BOOL tapBackgroundToDismiss; 49 | 50 | //tap item to select and confirm 51 | @property BOOL tapPickerViewItemToConfirm; 52 | 53 | /* 54 | 55 | @param headerTitle 56 | @param cancelButtonTitle 57 | @param confirmButtonTitle 58 | @param switchButtonTitle 59 | 60 | */ 61 | - (id)initWithHeaderTitle:(NSString *)headerTitle 62 | cancelButtonTitle:(NSString *)cancelButtonTitle 63 | confirmButtonTitle:(NSString *)confirmButtonTitle switchButtonTitle:(NSString *)switchButtonTitle; 64 | 65 | @property id delegate; 66 | @property id dataSource; 67 | 68 | //header background color */ 69 | @property (nonatomic, strong) UIColor *headerBackgroundColor; 70 | 71 | //header title color */ 72 | @property (nonatomic, strong) UIColor *headerTitleColor; 73 | 74 | //cancel button background color 75 | @property (nonatomic, strong) UIColor *cancelButtonBackgroundColor; 76 | 77 | //cancel button normal state color 78 | @property (nonatomic, strong) UIColor *cancelButtonNormalColor; 79 | 80 | //cancel button highlighted state color 81 | @property (nonatomic, strong) UIColor *cancelButtonHighlightedColor; 82 | 83 | //confirm button background color 84 | @property (nonatomic, strong) UIColor *confirmButtonBackgroundColor; 85 | 86 | //confirm button normal state color 87 | @property (nonatomic, strong) UIColor *confirmButtonNormalColor; 88 | 89 | //confirm button highlighted state color 90 | @property (nonatomic, strong) UIColor *confirmButtonHighlightedColor; 91 | 92 | //switch button title 93 | @property (nonatomic, strong) NSString *switchButtonTitle; 94 | 95 | 96 | //show the AlerPickerView 97 | 98 | - (void)show; 99 | 100 | //show AlerPickerView and default selected 101 | - (void)showAndSelectedIndex:(NSInteger)index; 102 | 103 | @end 104 | -------------------------------------------------------------------------------- /DYAlertPickerViewDemo/Base.lproj/LaunchScreen.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 20 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /DYAlertPickerViewDemo/DYAlertPickerView/DYAlertPickView.m: -------------------------------------------------------------------------------- 1 | // 2 | // DYAlerPickView.h 3 | // DYAlertPickerViewDemo 4 | // 5 | // Created by danny on 2015/7/7. 6 | // Copyright (c) 2015年 danny. All rights reserved. 7 | // 8 | 9 | #import "DYAlertPickView.h" 10 | 11 | #define DY_BACKGROUND_ALPHA 0.4 12 | #define DY_HEADER_HEIGHT 44.0 13 | #define DY_SWITCH_HEIGHT 35.0 14 | #define DY_FOOTER_HEIGHT 40.0 15 | #define DY_TABLEVIEW_CELL_HEIGHT 44.0 16 | 17 | 18 | @interface DYAlertPickView () 19 | @property NSString *headerTitle; 20 | @property NSString *cancelButtonTitle; 21 | @property NSString *confirmButtonTitle; 22 | @property UIView *backgroundMaskView; 23 | @property UIView *containerView; 24 | @property UIView *headerView; 25 | @property UIView *switchView; 26 | @property UIView *footerview; 27 | @property UITableView *tableView; 28 | @property NSIndexPath *selectedIndexPath; 29 | 30 | @end 31 | 32 | typedef void (^DYAlertPickerViewDismissCallback)(void); 33 | 34 | @implementation DYAlertPickView{ 35 | DYAlertPickerViewDismissCallback callback; 36 | BOOL isUIDeviceOrientation; 37 | } 38 | 39 | #pragma mark - initial UIControl 40 | 41 | - (id)initWithHeaderTitle:(NSString *)headerTitle 42 | cancelButtonTitle:(NSString *)cancelButtonTitle 43 | confirmButtonTitle:(NSString *)confirmButtonTitle switchButtonTitle:(NSString *)switchButtonTitle { 44 | self = [super init]; 45 | if(self){ 46 | self.tapBackgroundToDismiss = YES; 47 | 48 | self.headerTitle = headerTitle ? headerTitle : @""; 49 | self.headerTitleColor = [UIColor whiteColor]; 50 | self.headerBackgroundColor = [UIColor colorWithRed:51.0/255 green:153.0/255 blue:255.0/255 alpha:1]; 51 | 52 | // footer button 53 | self.confirmButtonTitle = confirmButtonTitle ? confirmButtonTitle: @""; 54 | self.confirmButtonNormalColor = [UIColor whiteColor]; 55 | self.confirmButtonHighlightedColor = [UIColor grayColor]; 56 | self.confirmButtonBackgroundColor = [UIColor colorWithRed:56.0/255 green:185.0/255 blue:158.0/255 alpha:1]; 57 | 58 | self.cancelButtonTitle = cancelButtonTitle ? cancelButtonTitle:@""; 59 | self.cancelButtonNormalColor = [UIColor whiteColor]; 60 | self.cancelButtonHighlightedColor = [UIColor grayColor]; 61 | self.cancelButtonBackgroundColor = [UIColor colorWithRed:255.0/255 green:71.0/255.0 blue:25.0/255 alpha:1]; 62 | 63 | self.switchButtonTitle = switchButtonTitle ? switchButtonTitle:@""; 64 | self.tapPickerViewItemToConfirm = NO; 65 | CGRect rect= [UIScreen mainScreen].bounds; 66 | self.frame = rect; 67 | isUIDeviceOrientation = NO; 68 | } 69 | return self; 70 | } 71 | 72 | - (void)setupSubViews { 73 | CGRect rect= [UIScreen mainScreen].bounds; 74 | self.frame = rect; 75 | //mask is full screen 76 | self.backgroundMaskView = [self buildBackgroundMaskView]; 77 | [self addSubview:self.backgroundMaskView]; 78 | 79 | self.containerView = [self buildContainerView]; 80 | [self addSubview:self.containerView]; 81 | 82 | self.tableView = [self buildTableView]; 83 | [self.containerView addSubview:self.tableView]; 84 | 85 | self.headerView = [self buildHeaderView]; 86 | [self.containerView addSubview:self.headerView]; 87 | self.switchView = [self buildSwitchView]; 88 | [self.containerView addSubview:self.switchView]; 89 | self.footerview = [self buildFooterView]; 90 | [self.containerView addSubview:self.footerview]; 91 | 92 | 93 | CGRect frame = self.containerView.frame; 94 | self.containerView.frame = CGRectMake(frame.origin.x, 95 | frame.origin.y, 96 | frame.size.width, 97 | self.headerView.frame.size.height + self.tableView.frame.size.height + 98 | self.footerview.frame.size.height + self.switchView.frame.size.height); 99 | 100 | self.containerView.center = CGPointMake(self.center.x, self.center.y); 101 | 102 | // 103 | [[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications]; 104 | [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(orientationChanged:) name:UIDeviceOrientationDidChangeNotification object:nil]; 105 | } 106 | 107 | 108 | - (UIView *)buildContainerView{ 109 | CGAffineTransform transform = CGAffineTransformMake(0.8, 0, 0.0, 0.6, 0, 0); 110 | CGRect newRect = CGRectApplyAffineTransform(self.frame, transform); 111 | UIView *bcv = [[UIView alloc] initWithFrame:newRect]; 112 | bcv.layer.cornerRadius = 5.0f; 113 | bcv.clipsToBounds = YES; 114 | return bcv; 115 | } 116 | 117 | - (UITableView *)buildTableView{ 118 | CGAffineTransform transform = CGAffineTransformMake(0.8, 0, 0, 0.6, 0, 0); 119 | CGRect newRect = CGRectApplyAffineTransform(self.frame, transform); 120 | NSInteger n = 0; 121 | if ([self.dataSource respondsToSelector:@selector(numberOfRowsInPickerview:)]) { 122 | n = [self.dataSource numberOfRowsInPickerview:self]; 123 | } 124 | CGRect tableRect; 125 | float heightOffset = DY_HEADER_HEIGHT + (([self.confirmButtonTitle isEqualToString:@""] && [self.cancelButtonTitle isEqualToString:@""])? 0.0f:DY_FOOTER_HEIGHT) + ([self.switchButtonTitle isEqualToString:@""]?0.0f:DY_SWITCH_HEIGHT); 126 | if(n > 0){ 127 | float height = n * DY_TABLEVIEW_CELL_HEIGHT; 128 | height = height > newRect.size.height - heightOffset ? newRect.size.height - heightOffset : height; 129 | tableRect = CGRectMake(0, DY_TABLEVIEW_CELL_HEIGHT, newRect.size.width, height); 130 | } else { 131 | tableRect = CGRectMake(0, DY_TABLEVIEW_CELL_HEIGHT, newRect.size.width, newRect.size.height - heightOffset); 132 | } 133 | UITableView *tableView = [[UITableView alloc] initWithFrame:tableRect style:UITableViewStylePlain]; 134 | tableView.delegate = self; 135 | tableView.dataSource = self; 136 | tableView.separatorStyle = UITableViewCellSeparatorStyleNone; 137 | return tableView; 138 | } 139 | 140 | - (UIView *)buildBackgroundMaskView{ 141 | 142 | UIView *bgv; 143 | bgv = [[UIView alloc] initWithFrame:self.frame]; 144 | bgv.alpha = 0.0; 145 | bgv.backgroundColor = [UIColor blackColor]; 146 | if(self.tapBackgroundToDismiss){ 147 | [bgv addGestureRecognizer: 148 | [[UITapGestureRecognizer alloc] initWithTarget:self 149 | action:@selector(cancelButtonPressed:)]]; 150 | } 151 | return bgv; 152 | } 153 | 154 | - (UIView *)buildFooterView{ 155 | 156 | if (([self.cancelButtonTitle isEqualToString:@""]) && ([self.confirmButtonTitle isEqualToString:@""])){ 157 | self.tapPickerViewItemToConfirm = YES; 158 | return [[UIView alloc] initWithFrame:CGRectMake(0, 0, 0, 0)]; 159 | } 160 | 161 | CGRect rect = ([self.switchButtonTitle isEqualToString:@""]?self.tableView.frame:self.switchView.frame); 162 | CGRect newRect = CGRectMake(0, 163 | rect.origin.y + rect.size.height, 164 | rect.size.width, 165 | DY_FOOTER_HEIGHT); 166 | 167 | CGRect leftRect = CGRectZero; 168 | CGRect rightRect = CGRectZero; 169 | // 170 | if ([self.cancelButtonTitle isEqualToString:@""]){ 171 | rightRect = CGRectMake(0,0, newRect.size.width, DY_FOOTER_HEIGHT); 172 | }else if ([self.confirmButtonTitle isEqualToString:@""]){ 173 | leftRect = CGRectMake(0,0, newRect.size.width, DY_FOOTER_HEIGHT); 174 | }else { 175 | leftRect = CGRectMake(0,0, (newRect.size.width /2), DY_FOOTER_HEIGHT); 176 | rightRect = CGRectMake((newRect.size.width/2),0, (newRect.size.width/2), DY_FOOTER_HEIGHT); 177 | } 178 | UIView *bfv = [[UIView alloc] initWithFrame:newRect]; 179 | bfv.backgroundColor = [UIColor blackColor]; 180 | // 181 | if ((leftRect.size.width > 0) && (leftRect.size.height > 0)) { 182 | 183 | UIButton *cancelButton = [[UIButton alloc] initWithFrame:leftRect]; 184 | [cancelButton setTitle:self.cancelButtonTitle forState:UIControlStateNormal]; 185 | [cancelButton setTitleColor: self.cancelButtonNormalColor forState:UIControlStateNormal]; 186 | [cancelButton setTitleColor:self.cancelButtonHighlightedColor forState:UIControlStateHighlighted]; 187 | cancelButton.titleLabel.font = [UIFont boldSystemFontOfSize:16]; 188 | cancelButton.backgroundColor = self.cancelButtonBackgroundColor; 189 | [cancelButton addTarget:self action:@selector(cancelButtonPressed:) forControlEvents:UIControlEventTouchUpInside]; 190 | [bfv addSubview:cancelButton]; 191 | } 192 | if ((rightRect.size.width > 0) && (rightRect.size.height > 0)) { 193 | UIButton *confirmButton = [[UIButton alloc] initWithFrame:rightRect]; 194 | [confirmButton setTitle:self.confirmButtonTitle forState:UIControlStateNormal]; 195 | [confirmButton setTitleColor:self.confirmButtonNormalColor forState:UIControlStateNormal]; 196 | [confirmButton setTitleColor:self.confirmButtonHighlightedColor forState:UIControlStateHighlighted]; 197 | confirmButton.titleLabel.font = [UIFont systemFontOfSize:16]; 198 | confirmButton.backgroundColor = self.confirmButtonBackgroundColor; 199 | [confirmButton addTarget:self action:@selector(confirmButtonPressed:) forControlEvents:UIControlEventTouchUpInside]; 200 | [bfv addSubview:confirmButton]; 201 | } 202 | 203 | 204 | 205 | return bfv; 206 | } 207 | 208 | 209 | - (UIView *)buildHeaderView { 210 | UIView *bhv = [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.tableView.frame.size.width, DY_HEADER_HEIGHT)]; 211 | bhv.backgroundColor = self.headerBackgroundColor; 212 | NSDictionary *dict = @{ 213 | NSForegroundColorAttributeName: self.headerTitleColor, 214 | NSFontAttributeName: [UIFont systemFontOfSize:16.0] 215 | }; 216 | NSAttributedString *at = [[NSAttributedString alloc] initWithString:self.headerTitle attributes:dict]; 217 | UILabel *label = [[UILabel alloc] initWithFrame:bhv.frame]; 218 | label.attributedText = at; 219 | [label sizeToFit]; 220 | [bhv addSubview:label]; 221 | label.center = bhv.center; 222 | return bhv; 223 | } 224 | 225 | - (UIView *)buildSwitchView { 226 | if ([self.switchButtonTitle isEqualToString:@""]){ 227 | return [[UIView alloc] initWithFrame:CGRectMake(0, 0, 0, 0)]; 228 | } 229 | UIView *bsv = [[UIView alloc] initWithFrame:CGRectMake(0, self.tableView.frame.origin.y + self.tableView.frame.size.height + 1, self.tableView.frame.size.width, DY_SWITCH_HEIGHT)]; 230 | bsv.backgroundColor = [UIColor whiteColor]; 231 | UISwitch *sw = [[UISwitch alloc] initWithFrame:CGRectZero]; 232 | sw.frame = CGRectMake(self.tableView.frame.size.width - sw.frame.size.width - 2, (bsv.frame.size.height - sw.frame.size.height)/2, sw.frame.size.width, sw.frame.size.height); 233 | [sw addTarget:self action:@selector(switchButtonValueChanged:) forControlEvents:UIControlEventValueChanged]; 234 | UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(15, 0, bsv.frame.size.width - sw.frame.size.width - 15, bsv.frame.size.height)]; 235 | if([self.delegate respondsToSelector:@selector(pickerviewStateOfSwitchButton)]){ 236 | sw.on = [self.delegate pickerviewStateOfSwitchButton]; 237 | } 238 | label.text = self.switchButtonTitle; 239 | label.textColor = [UIColor darkGrayColor]; 240 | [label setNeedsDisplay]; 241 | [bsv addSubview:label]; 242 | [bsv addSubview:sw]; 243 | return bsv; 244 | } 245 | 246 | #pragma mark - show/dismiss DYAlertPickerView 247 | 248 | - (void)show { 249 | [self showAndSelectedIndex:-1]; 250 | } 251 | 252 | - (void)showAndSelectedIndex:(NSInteger)index { 253 | 254 | [self setupSubViews]; 255 | UIWindow *mainWindow = [[[UIApplication sharedApplication] delegate] window]; 256 | self.frame = mainWindow.frame; 257 | [mainWindow addSubview:self]; 258 | 259 | self.containerView.layer.opacity = 1.0f; 260 | self.layer.opacity = 0.5f; 261 | self.layer.transform = CATransform3DMakeScale(1.5f, 1.5f, 1.0f); 262 | 263 | [UIView animateWithDuration:0.2f delay:0.0 options:UIViewAnimationOptionCurveEaseIn 264 | animations:^{ 265 | self.backgroundColor = [UIColor colorWithRed:0 green:0 blue:0 alpha:0.4f]; 266 | self.layer.opacity = 1.0f; 267 | self.backgroundMaskView.layer.opacity = 0.5f; 268 | self.layer.transform = CATransform3DMakeScale(1, 1, 1); 269 | } 270 | completion:^(BOOL finished) { 271 | NSInteger numberOfRows = [self.tableView numberOfRowsInSection:0]; 272 | if ((index >=0) && (index <= numberOfRows)) { 273 | dispatch_async(dispatch_get_main_queue(), ^{ 274 | self.selectedIndexPath = [NSIndexPath indexPathForRow:index inSection:0]; 275 | [self.tableView reloadData]; 276 | }); 277 | 278 | } 279 | 280 | } 281 | 282 | ]; 283 | } 284 | 285 | - (void)dismiss:(DYAlertPickerViewDismissCallback)completion { 286 | callback = completion; 287 | 288 | if(callback){ 289 | callback(); 290 | } 291 | float delayTime; 292 | if (self.tapPickerViewItemToConfirm) { 293 | delayTime = 0.5; 294 | }else { 295 | delayTime = 0; 296 | } 297 | dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(delayTime * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ 298 | [UIView animateWithDuration:0.4f delay:0.0 options:UIViewAnimationOptionCurveEaseOut 299 | animations:^{ 300 | self.backgroundColor = [UIColor colorWithRed:0 green:0 blue:0 alpha:0.4f]; 301 | self.layer.opacity = 0.1f; 302 | self.layer.transform = CATransform3DMakeScale(3.0f, 3.0f, 1.0f); 303 | } 304 | completion:^(BOOL finished) { 305 | for (UIView *v in [self subviews]) { 306 | [v removeFromSuperview]; 307 | } 308 | self.layer.transform = CATransform3DMakeScale(1, 1, 1); 309 | [self removeFromSuperview]; 310 | [self setNeedsDisplay]; 311 | } 312 | ]; 313 | }); 314 | // Request to stop receiving accelerometer events and turn off accelerometer 315 | [[NSNotificationCenter defaultCenter] removeObserver:self]; 316 | [[UIDevice currentDevice] endGeneratingDeviceOrientationNotifications]; 317 | 318 | } 319 | 320 | - (void)orientationChanged:(NSNotification *)notification { 321 | // Respond to changes in device orientation 322 | UIDeviceOrientation orientation = [UIDevice currentDevice].orientation; 323 | 324 | if (isUIDeviceOrientation == NO 325 | && (UIDeviceOrientationIsPortrait(orientation) 326 | || UIDeviceOrientationIsLandscape(orientation))) { 327 | 328 | } else { 329 | return; 330 | } 331 | 332 | isUIDeviceOrientation = YES; 333 | dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ 334 | for (UIView *v in [self subviews]) { 335 | [v removeFromSuperview]; 336 | } 337 | self.layer.transform = CATransform3DMakeScale(1, 1, 1); 338 | [self removeFromSuperview]; 339 | [self setNeedsDisplay]; 340 | // Request to stop receiving accelerometer events and turn off accelerometer 341 | [[NSNotificationCenter defaultCenter] removeObserver:self]; 342 | [[UIDevice currentDevice] endGeneratingDeviceOrientationNotifications]; 343 | [self show]; 344 | dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.3 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ 345 | isUIDeviceOrientation = NO; 346 | }); 347 | 348 | }); 349 | 350 | } 351 | 352 | #pragma mark - cancel/confirm button delegate 353 | 354 | - (IBAction)cancelButtonPressed:(UIButton *)sender { 355 | [self dismiss:^{ 356 | if([self.delegate respondsToSelector:@selector(pickerviewDidClickCancelButton:)]){ 357 | [self.delegate pickerviewDidClickCancelButton:self]; 358 | } 359 | }]; 360 | } 361 | 362 | - (IBAction)confirmButtonPressed:(UIButton *)sender { 363 | [self dismiss:^{ 364 | if(self.selectedIndexPath && [self.delegate respondsToSelector:@selector(pickerview:didConfirmWithItemAtRow:)]){ 365 | [self.delegate pickerview:self didConfirmWithItemAtRow:self.selectedIndexPath.row]; 366 | } 367 | }]; 368 | } 369 | 370 | - (IBAction)switchButtonValueChanged:(UISwitch *)sender { 371 | NSAssert(![self.delegate respondsToSelector:@selector(pickerviewDidClickSwitchButton:)], @"DYAlertPickerViewDidClickSwitchButton: is deprecated"); 372 | 373 | if([self.delegate respondsToSelector:@selector(pickerviewDidClickSwitchButton:switchButton:)]){ 374 | [self.delegate pickerviewDidClickSwitchButton:self switchButton:sender]; 375 | } 376 | } 377 | 378 | #pragma mark - UITableViewDataSource 379 | 380 | - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { 381 | if ([self.dataSource respondsToSelector:@selector(numberOfRowsInPickerview:)]) { 382 | return [self.dataSource numberOfRowsInPickerview:self]; 383 | } 384 | return 1; 385 | } 386 | 387 | - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { 388 | static NSString *cellIdentifier = @"picker_view_identifier"; 389 | UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier]; 390 | if (!cell) { 391 | cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier: cellIdentifier]; 392 | } 393 | if(self.selectedIndexPath && [self.selectedIndexPath isEqual:indexPath]){ 394 | cell.accessoryType = UITableViewCellAccessoryCheckmark; 395 | } else { 396 | cell.accessoryType = UITableViewCellAccessoryNone; 397 | } 398 | if ([self.dataSource respondsToSelector:@selector(pickerview:titleForRow:)]) { 399 | cell.textLabel.attributedText = [self.dataSource pickerview:self titleForRow:indexPath.row]; 400 | } 401 | return cell; 402 | } 403 | 404 | 405 | #pragma mark - UITableViewDelegate 406 | 407 | - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { 408 | UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath]; 409 | if(self.selectedIndexPath){ 410 | UITableViewCell *prevCell = [tableView cellForRowAtIndexPath:self.selectedIndexPath]; 411 | if(prevCell){ 412 | prevCell.accessoryType = UITableViewCellAccessoryNone; 413 | cell.accessoryType = UITableViewCellAccessoryCheckmark; 414 | } else { 415 | cell.accessoryType = UITableViewCellAccessoryCheckmark; 416 | } 417 | } else{ 418 | cell.accessoryType = UITableViewCellAccessoryCheckmark; 419 | } 420 | self.selectedIndexPath = indexPath; 421 | [tableView deselectRowAtIndexPath:indexPath animated:YES]; 422 | if(self.tapPickerViewItemToConfirm && [self.delegate respondsToSelector:@selector(pickerview:didConfirmWithItemAtRow:)]){ 423 | [self dismiss:^{ 424 | [self.delegate pickerview:self didConfirmWithItemAtRow:indexPath.row]; 425 | }]; 426 | } 427 | } 428 | @end 429 | -------------------------------------------------------------------------------- /DYAlertPickerViewDemo.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 3002D4071C3E5DE400C5AECB /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3002D4061C3E5DE400C5AECB /* AppDelegate.swift */; }; 11 | 3002D4091C3E5DE400C5AECB /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3002D4081C3E5DE400C5AECB /* ViewController.swift */; }; 12 | 3002D40C1C3E5DE400C5AECB /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 3002D40A1C3E5DE400C5AECB /* Main.storyboard */; }; 13 | 3002D40E1C3E5DE400C5AECB /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 3002D40D1C3E5DE400C5AECB /* Assets.xcassets */; }; 14 | 3002D4111C3E5DE400C5AECB /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 3002D40F1C3E5DE400C5AECB /* LaunchScreen.storyboard */; }; 15 | 301B53761C3E987100761C1C /* DYAlertPickView.m in Sources */ = {isa = PBXBuildFile; fileRef = 30C356F61B4BBBBD0067C7FE /* DYAlertPickView.m */; }; 16 | 30C356D11B4BBB7B0067C7FE /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 30C356D01B4BBB7B0067C7FE /* main.m */; }; 17 | 30C356D41B4BBB7B0067C7FE /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 30C356D31B4BBB7B0067C7FE /* AppDelegate.m */; }; 18 | 30C356D71B4BBB7B0067C7FE /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 30C356D61B4BBB7B0067C7FE /* ViewController.m */; }; 19 | 30C356DA1B4BBB7B0067C7FE /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 30C356D81B4BBB7B0067C7FE /* Main.storyboard */; }; 20 | 30C356DC1B4BBB7B0067C7FE /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 30C356DB1B4BBB7B0067C7FE /* Images.xcassets */; }; 21 | 30C356DF1B4BBB7B0067C7FE /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = 30C356DD1B4BBB7B0067C7FE /* LaunchScreen.xib */; }; 22 | 30C356F71B4BBBBD0067C7FE /* DYAlertPickView.m in Sources */ = {isa = PBXBuildFile; fileRef = 30C356F61B4BBBBD0067C7FE /* DYAlertPickView.m */; }; 23 | /* End PBXBuildFile section */ 24 | 25 | /* Begin PBXFileReference section */ 26 | 3002D4041C3E5DE400C5AECB /* DYAlertPickerViewDemo-Swift.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "DYAlertPickerViewDemo-Swift.app"; sourceTree = BUILT_PRODUCTS_DIR; }; 27 | 3002D4061C3E5DE400C5AECB /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 28 | 3002D4081C3E5DE400C5AECB /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; 29 | 3002D40B1C3E5DE400C5AECB /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 30 | 3002D40D1C3E5DE400C5AECB /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 31 | 3002D4101C3E5DE400C5AECB /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 32 | 3002D4121C3E5DE400C5AECB /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 33 | 3002D4161C3E5E5400C5AECB /* DYAlertPickerView-Bridging-Header.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "DYAlertPickerView-Bridging-Header.h"; sourceTree = ""; }; 34 | 30C356CB1B4BBB7B0067C7FE /* DYAlertPickerViewDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = DYAlertPickerViewDemo.app; sourceTree = BUILT_PRODUCTS_DIR; }; 35 | 30C356CF1B4BBB7B0067C7FE /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 36 | 30C356D01B4BBB7B0067C7FE /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 37 | 30C356D21B4BBB7B0067C7FE /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 38 | 30C356D31B4BBB7B0067C7FE /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 39 | 30C356D51B4BBB7B0067C7FE /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; 40 | 30C356D61B4BBB7B0067C7FE /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; 41 | 30C356D91B4BBB7B0067C7FE /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 42 | 30C356DB1B4BBB7B0067C7FE /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; 43 | 30C356DE1B4BBB7B0067C7FE /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/LaunchScreen.xib; sourceTree = ""; }; 44 | 30C356E91B4BBB7B0067C7FE /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 45 | 30C356EA1B4BBB7B0067C7FE /* DYAlertPickerViewDemoTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = DYAlertPickerViewDemoTests.m; sourceTree = ""; }; 46 | 30C356F51B4BBBBD0067C7FE /* DYAlertPickView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DYAlertPickView.h; sourceTree = ""; }; 47 | 30C356F61B4BBBBD0067C7FE /* DYAlertPickView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DYAlertPickView.m; sourceTree = ""; }; 48 | /* End PBXFileReference section */ 49 | 50 | /* Begin PBXFrameworksBuildPhase section */ 51 | 3002D4011C3E5DE400C5AECB /* Frameworks */ = { 52 | isa = PBXFrameworksBuildPhase; 53 | buildActionMask = 2147483647; 54 | files = ( 55 | ); 56 | runOnlyForDeploymentPostprocessing = 0; 57 | }; 58 | 30C356C81B4BBB7B0067C7FE /* Frameworks */ = { 59 | isa = PBXFrameworksBuildPhase; 60 | buildActionMask = 2147483647; 61 | files = ( 62 | ); 63 | runOnlyForDeploymentPostprocessing = 0; 64 | }; 65 | /* End PBXFrameworksBuildPhase section */ 66 | 67 | /* Begin PBXGroup section */ 68 | 3002D4051C3E5DE400C5AECB /* DYAlertPickerViewDemo-Swift */ = { 69 | isa = PBXGroup; 70 | children = ( 71 | 3002D4061C3E5DE400C5AECB /* AppDelegate.swift */, 72 | 3002D4081C3E5DE400C5AECB /* ViewController.swift */, 73 | 3002D40A1C3E5DE400C5AECB /* Main.storyboard */, 74 | 3002D40D1C3E5DE400C5AECB /* Assets.xcassets */, 75 | 3002D40F1C3E5DE400C5AECB /* LaunchScreen.storyboard */, 76 | 3002D4121C3E5DE400C5AECB /* Info.plist */, 77 | 3002D4161C3E5E5400C5AECB /* DYAlertPickerView-Bridging-Header.h */, 78 | ); 79 | path = "DYAlertPickerViewDemo-Swift"; 80 | sourceTree = ""; 81 | }; 82 | 30C356C21B4BBB7B0067C7FE = { 83 | isa = PBXGroup; 84 | children = ( 85 | 30C356F41B4BBBBD0067C7FE /* DYAlertPickerView */, 86 | 30C356CD1B4BBB7B0067C7FE /* DYAlertPickerViewDemo */, 87 | 30C356E71B4BBB7B0067C7FE /* DYAlertPickerViewDemoTests */, 88 | 3002D4051C3E5DE400C5AECB /* DYAlertPickerViewDemo-Swift */, 89 | 30C356CC1B4BBB7B0067C7FE /* Products */, 90 | ); 91 | sourceTree = ""; 92 | }; 93 | 30C356CC1B4BBB7B0067C7FE /* Products */ = { 94 | isa = PBXGroup; 95 | children = ( 96 | 30C356CB1B4BBB7B0067C7FE /* DYAlertPickerViewDemo.app */, 97 | 3002D4041C3E5DE400C5AECB /* DYAlertPickerViewDemo-Swift.app */, 98 | ); 99 | name = Products; 100 | sourceTree = ""; 101 | }; 102 | 30C356CD1B4BBB7B0067C7FE /* DYAlertPickerViewDemo */ = { 103 | isa = PBXGroup; 104 | children = ( 105 | 30C356D21B4BBB7B0067C7FE /* AppDelegate.h */, 106 | 30C356D31B4BBB7B0067C7FE /* AppDelegate.m */, 107 | 30C356D51B4BBB7B0067C7FE /* ViewController.h */, 108 | 30C356D61B4BBB7B0067C7FE /* ViewController.m */, 109 | 30C356D81B4BBB7B0067C7FE /* Main.storyboard */, 110 | 30C356DB1B4BBB7B0067C7FE /* Images.xcassets */, 111 | 30C356DD1B4BBB7B0067C7FE /* LaunchScreen.xib */, 112 | 30C356CE1B4BBB7B0067C7FE /* Supporting Files */, 113 | ); 114 | path = DYAlertPickerViewDemo; 115 | sourceTree = ""; 116 | }; 117 | 30C356CE1B4BBB7B0067C7FE /* Supporting Files */ = { 118 | isa = PBXGroup; 119 | children = ( 120 | 30C356CF1B4BBB7B0067C7FE /* Info.plist */, 121 | 30C356D01B4BBB7B0067C7FE /* main.m */, 122 | ); 123 | name = "Supporting Files"; 124 | sourceTree = ""; 125 | }; 126 | 30C356E71B4BBB7B0067C7FE /* DYAlertPickerViewDemoTests */ = { 127 | isa = PBXGroup; 128 | children = ( 129 | 30C356EA1B4BBB7B0067C7FE /* DYAlertPickerViewDemoTests.m */, 130 | 30C356E81B4BBB7B0067C7FE /* Supporting Files */, 131 | ); 132 | path = DYAlertPickerViewDemoTests; 133 | sourceTree = ""; 134 | }; 135 | 30C356E81B4BBB7B0067C7FE /* Supporting Files */ = { 136 | isa = PBXGroup; 137 | children = ( 138 | 30C356E91B4BBB7B0067C7FE /* Info.plist */, 139 | ); 140 | name = "Supporting Files"; 141 | sourceTree = ""; 142 | }; 143 | 30C356F41B4BBBBD0067C7FE /* DYAlertPickerView */ = { 144 | isa = PBXGroup; 145 | children = ( 146 | 30C356F51B4BBBBD0067C7FE /* DYAlertPickView.h */, 147 | 30C356F61B4BBBBD0067C7FE /* DYAlertPickView.m */, 148 | ); 149 | name = DYAlertPickerView; 150 | path = DYAlertPickerViewDemo/DYAlertPickerView; 151 | sourceTree = ""; 152 | }; 153 | /* End PBXGroup section */ 154 | 155 | /* Begin PBXNativeTarget section */ 156 | 3002D4031C3E5DE400C5AECB /* DYAlertPickerViewDemo-Swift */ = { 157 | isa = PBXNativeTarget; 158 | buildConfigurationList = 3002D4131C3E5DE400C5AECB /* Build configuration list for PBXNativeTarget "DYAlertPickerViewDemo-Swift" */; 159 | buildPhases = ( 160 | 3002D4001C3E5DE400C5AECB /* Sources */, 161 | 3002D4011C3E5DE400C5AECB /* Frameworks */, 162 | 3002D4021C3E5DE400C5AECB /* Resources */, 163 | ); 164 | buildRules = ( 165 | ); 166 | dependencies = ( 167 | ); 168 | name = "DYAlertPickerViewDemo-Swift"; 169 | productName = "DYAlertPickerViewDemo-Swift"; 170 | productReference = 3002D4041C3E5DE400C5AECB /* DYAlertPickerViewDemo-Swift.app */; 171 | productType = "com.apple.product-type.application"; 172 | }; 173 | 30C356CA1B4BBB7B0067C7FE /* DYAlertPickerViewDemo */ = { 174 | isa = PBXNativeTarget; 175 | buildConfigurationList = 30C356EE1B4BBB7B0067C7FE /* Build configuration list for PBXNativeTarget "DYAlertPickerViewDemo" */; 176 | buildPhases = ( 177 | 30C356C71B4BBB7B0067C7FE /* Sources */, 178 | 30C356C81B4BBB7B0067C7FE /* Frameworks */, 179 | 30C356C91B4BBB7B0067C7FE /* Resources */, 180 | ); 181 | buildRules = ( 182 | ); 183 | dependencies = ( 184 | ); 185 | name = DYAlertPickerViewDemo; 186 | productName = DYAlertPickerViewDemo; 187 | productReference = 30C356CB1B4BBB7B0067C7FE /* DYAlertPickerViewDemo.app */; 188 | productType = "com.apple.product-type.application"; 189 | }; 190 | /* End PBXNativeTarget section */ 191 | 192 | /* Begin PBXProject section */ 193 | 30C356C31B4BBB7B0067C7FE /* Project object */ = { 194 | isa = PBXProject; 195 | attributes = { 196 | LastSwiftUpdateCheck = 0720; 197 | LastUpgradeCheck = 0720; 198 | ORGANIZATIONNAME = danny; 199 | TargetAttributes = { 200 | 3002D4031C3E5DE400C5AECB = { 201 | CreatedOnToolsVersion = 7.2; 202 | }; 203 | 30C356CA1B4BBB7B0067C7FE = { 204 | CreatedOnToolsVersion = 6.4; 205 | }; 206 | }; 207 | }; 208 | buildConfigurationList = 30C356C61B4BBB7B0067C7FE /* Build configuration list for PBXProject "DYAlertPickerViewDemo" */; 209 | compatibilityVersion = "Xcode 3.2"; 210 | developmentRegion = English; 211 | hasScannedForEncodings = 0; 212 | knownRegions = ( 213 | en, 214 | Base, 215 | ); 216 | mainGroup = 30C356C21B4BBB7B0067C7FE; 217 | productRefGroup = 30C356CC1B4BBB7B0067C7FE /* Products */; 218 | projectDirPath = ""; 219 | projectRoot = ""; 220 | targets = ( 221 | 30C356CA1B4BBB7B0067C7FE /* DYAlertPickerViewDemo */, 222 | 3002D4031C3E5DE400C5AECB /* DYAlertPickerViewDemo-Swift */, 223 | ); 224 | }; 225 | /* End PBXProject section */ 226 | 227 | /* Begin PBXResourcesBuildPhase section */ 228 | 3002D4021C3E5DE400C5AECB /* Resources */ = { 229 | isa = PBXResourcesBuildPhase; 230 | buildActionMask = 2147483647; 231 | files = ( 232 | 3002D4111C3E5DE400C5AECB /* LaunchScreen.storyboard in Resources */, 233 | 3002D40E1C3E5DE400C5AECB /* Assets.xcassets in Resources */, 234 | 3002D40C1C3E5DE400C5AECB /* Main.storyboard in Resources */, 235 | ); 236 | runOnlyForDeploymentPostprocessing = 0; 237 | }; 238 | 30C356C91B4BBB7B0067C7FE /* Resources */ = { 239 | isa = PBXResourcesBuildPhase; 240 | buildActionMask = 2147483647; 241 | files = ( 242 | 30C356DA1B4BBB7B0067C7FE /* Main.storyboard in Resources */, 243 | 30C356DF1B4BBB7B0067C7FE /* LaunchScreen.xib in Resources */, 244 | 30C356DC1B4BBB7B0067C7FE /* Images.xcassets in Resources */, 245 | ); 246 | runOnlyForDeploymentPostprocessing = 0; 247 | }; 248 | /* End PBXResourcesBuildPhase section */ 249 | 250 | /* Begin PBXSourcesBuildPhase section */ 251 | 3002D4001C3E5DE400C5AECB /* Sources */ = { 252 | isa = PBXSourcesBuildPhase; 253 | buildActionMask = 2147483647; 254 | files = ( 255 | 3002D4091C3E5DE400C5AECB /* ViewController.swift in Sources */, 256 | 3002D4071C3E5DE400C5AECB /* AppDelegate.swift in Sources */, 257 | 301B53761C3E987100761C1C /* DYAlertPickView.m in Sources */, 258 | ); 259 | runOnlyForDeploymentPostprocessing = 0; 260 | }; 261 | 30C356C71B4BBB7B0067C7FE /* Sources */ = { 262 | isa = PBXSourcesBuildPhase; 263 | buildActionMask = 2147483647; 264 | files = ( 265 | 30C356D71B4BBB7B0067C7FE /* ViewController.m in Sources */, 266 | 30C356D41B4BBB7B0067C7FE /* AppDelegate.m in Sources */, 267 | 30C356F71B4BBBBD0067C7FE /* DYAlertPickView.m in Sources */, 268 | 30C356D11B4BBB7B0067C7FE /* main.m in Sources */, 269 | ); 270 | runOnlyForDeploymentPostprocessing = 0; 271 | }; 272 | /* End PBXSourcesBuildPhase section */ 273 | 274 | /* Begin PBXVariantGroup section */ 275 | 3002D40A1C3E5DE400C5AECB /* Main.storyboard */ = { 276 | isa = PBXVariantGroup; 277 | children = ( 278 | 3002D40B1C3E5DE400C5AECB /* Base */, 279 | ); 280 | name = Main.storyboard; 281 | sourceTree = ""; 282 | }; 283 | 3002D40F1C3E5DE400C5AECB /* LaunchScreen.storyboard */ = { 284 | isa = PBXVariantGroup; 285 | children = ( 286 | 3002D4101C3E5DE400C5AECB /* Base */, 287 | ); 288 | name = LaunchScreen.storyboard; 289 | sourceTree = ""; 290 | }; 291 | 30C356D81B4BBB7B0067C7FE /* Main.storyboard */ = { 292 | isa = PBXVariantGroup; 293 | children = ( 294 | 30C356D91B4BBB7B0067C7FE /* Base */, 295 | ); 296 | name = Main.storyboard; 297 | sourceTree = ""; 298 | }; 299 | 30C356DD1B4BBB7B0067C7FE /* LaunchScreen.xib */ = { 300 | isa = PBXVariantGroup; 301 | children = ( 302 | 30C356DE1B4BBB7B0067C7FE /* Base */, 303 | ); 304 | name = LaunchScreen.xib; 305 | sourceTree = ""; 306 | }; 307 | /* End PBXVariantGroup section */ 308 | 309 | /* Begin XCBuildConfiguration section */ 310 | 3002D4141C3E5DE400C5AECB /* Debug */ = { 311 | isa = XCBuildConfiguration; 312 | buildSettings = { 313 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 314 | DEBUG_INFORMATION_FORMAT = dwarf; 315 | INFOPLIST_FILE = "DYAlertPickerViewDemo-Swift/Info.plist"; 316 | IPHONEOS_DEPLOYMENT_TARGET = 8.1; 317 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 318 | ONLY_ACTIVE_ARCH = YES; 319 | PRODUCT_BUNDLE_IDENTIFIER = "tw.35g.cms.ios.DYAlertPickerViewDemo-Swift"; 320 | PRODUCT_NAME = "$(TARGET_NAME)"; 321 | "SWIFT_OBJC_BRIDGING_HEADER[arch=*]" = "DYAlertPickerViewDemo-Swift/DYAlertPickerView-Bridging-Header.h"; 322 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 323 | }; 324 | name = Debug; 325 | }; 326 | 3002D4151C3E5DE400C5AECB /* Release */ = { 327 | isa = XCBuildConfiguration; 328 | buildSettings = { 329 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 330 | INFOPLIST_FILE = "DYAlertPickerViewDemo-Swift/Info.plist"; 331 | IPHONEOS_DEPLOYMENT_TARGET = 8.1; 332 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 333 | PRODUCT_BUNDLE_IDENTIFIER = "tw.35g.cms.ios.DYAlertPickerViewDemo-Swift"; 334 | PRODUCT_NAME = "$(TARGET_NAME)"; 335 | "SWIFT_OBJC_BRIDGING_HEADER[arch=*]" = "DYAlertPickerViewDemo-Swift/DYAlertPickerView-Bridging-Header.h"; 336 | }; 337 | name = Release; 338 | }; 339 | 30C356EC1B4BBB7B0067C7FE /* Debug */ = { 340 | isa = XCBuildConfiguration; 341 | buildSettings = { 342 | ALWAYS_SEARCH_USER_PATHS = NO; 343 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 344 | CLANG_CXX_LIBRARY = "libc++"; 345 | CLANG_ENABLE_MODULES = YES; 346 | CLANG_ENABLE_OBJC_ARC = YES; 347 | CLANG_WARN_BOOL_CONVERSION = YES; 348 | CLANG_WARN_CONSTANT_CONVERSION = YES; 349 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 350 | CLANG_WARN_EMPTY_BODY = YES; 351 | CLANG_WARN_ENUM_CONVERSION = YES; 352 | CLANG_WARN_INT_CONVERSION = YES; 353 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 354 | CLANG_WARN_UNREACHABLE_CODE = YES; 355 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 356 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 357 | COPY_PHASE_STRIP = NO; 358 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 359 | ENABLE_STRICT_OBJC_MSGSEND = YES; 360 | ENABLE_TESTABILITY = YES; 361 | GCC_C_LANGUAGE_STANDARD = gnu99; 362 | GCC_DYNAMIC_NO_PIC = NO; 363 | GCC_NO_COMMON_BLOCKS = YES; 364 | GCC_OPTIMIZATION_LEVEL = 0; 365 | GCC_PREPROCESSOR_DEFINITIONS = ( 366 | "DEBUG=1", 367 | "$(inherited)", 368 | ); 369 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 370 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 371 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 372 | GCC_WARN_UNDECLARED_SELECTOR = YES; 373 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 374 | GCC_WARN_UNUSED_FUNCTION = YES; 375 | GCC_WARN_UNUSED_VARIABLE = YES; 376 | IPHONEOS_DEPLOYMENT_TARGET = 7.1; 377 | MTL_ENABLE_DEBUG_INFO = YES; 378 | ONLY_ACTIVE_ARCH = NO; 379 | SDKROOT = iphoneos; 380 | TARGETED_DEVICE_FAMILY = "1,2"; 381 | }; 382 | name = Debug; 383 | }; 384 | 30C356ED1B4BBB7B0067C7FE /* Release */ = { 385 | isa = XCBuildConfiguration; 386 | buildSettings = { 387 | ALWAYS_SEARCH_USER_PATHS = NO; 388 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 389 | CLANG_CXX_LIBRARY = "libc++"; 390 | CLANG_ENABLE_MODULES = YES; 391 | CLANG_ENABLE_OBJC_ARC = YES; 392 | CLANG_WARN_BOOL_CONVERSION = YES; 393 | CLANG_WARN_CONSTANT_CONVERSION = YES; 394 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 395 | CLANG_WARN_EMPTY_BODY = YES; 396 | CLANG_WARN_ENUM_CONVERSION = YES; 397 | CLANG_WARN_INT_CONVERSION = YES; 398 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 399 | CLANG_WARN_UNREACHABLE_CODE = YES; 400 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 401 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 402 | COPY_PHASE_STRIP = NO; 403 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 404 | ENABLE_NS_ASSERTIONS = NO; 405 | ENABLE_STRICT_OBJC_MSGSEND = YES; 406 | GCC_C_LANGUAGE_STANDARD = gnu99; 407 | GCC_NO_COMMON_BLOCKS = YES; 408 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 409 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 410 | GCC_WARN_UNDECLARED_SELECTOR = YES; 411 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 412 | GCC_WARN_UNUSED_FUNCTION = YES; 413 | GCC_WARN_UNUSED_VARIABLE = YES; 414 | IPHONEOS_DEPLOYMENT_TARGET = 7.1; 415 | MTL_ENABLE_DEBUG_INFO = NO; 416 | ONLY_ACTIVE_ARCH = NO; 417 | SDKROOT = iphoneos; 418 | TARGETED_DEVICE_FAMILY = "1,2"; 419 | VALIDATE_PRODUCT = YES; 420 | }; 421 | name = Release; 422 | }; 423 | 30C356EF1B4BBB7B0067C7FE /* Debug */ = { 424 | isa = XCBuildConfiguration; 425 | buildSettings = { 426 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 427 | ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; 428 | INFOPLIST_FILE = DYAlertPickerViewDemo/Info.plist; 429 | IPHONEOS_DEPLOYMENT_TARGET = 7.1; 430 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 431 | ONLY_ACTIVE_ARCH = NO; 432 | PRODUCT_BUNDLE_IDENTIFIER = "tw.35g.cms.ui.$(PRODUCT_NAME:rfc1034identifier)"; 433 | PRODUCT_NAME = "$(TARGET_NAME)"; 434 | TARGETED_DEVICE_FAMILY = "1,2"; 435 | }; 436 | name = Debug; 437 | }; 438 | 30C356F01B4BBB7B0067C7FE /* Release */ = { 439 | isa = XCBuildConfiguration; 440 | buildSettings = { 441 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 442 | ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; 443 | INFOPLIST_FILE = DYAlertPickerViewDemo/Info.plist; 444 | IPHONEOS_DEPLOYMENT_TARGET = 7.1; 445 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 446 | ONLY_ACTIVE_ARCH = NO; 447 | PRODUCT_BUNDLE_IDENTIFIER = "tw.35g.cms.ui.$(PRODUCT_NAME:rfc1034identifier)"; 448 | PRODUCT_NAME = "$(TARGET_NAME)"; 449 | TARGETED_DEVICE_FAMILY = "1,2"; 450 | }; 451 | name = Release; 452 | }; 453 | /* End XCBuildConfiguration section */ 454 | 455 | /* Begin XCConfigurationList section */ 456 | 3002D4131C3E5DE400C5AECB /* Build configuration list for PBXNativeTarget "DYAlertPickerViewDemo-Swift" */ = { 457 | isa = XCConfigurationList; 458 | buildConfigurations = ( 459 | 3002D4141C3E5DE400C5AECB /* Debug */, 460 | 3002D4151C3E5DE400C5AECB /* Release */, 461 | ); 462 | defaultConfigurationIsVisible = 0; 463 | defaultConfigurationName = Release; 464 | }; 465 | 30C356C61B4BBB7B0067C7FE /* Build configuration list for PBXProject "DYAlertPickerViewDemo" */ = { 466 | isa = XCConfigurationList; 467 | buildConfigurations = ( 468 | 30C356EC1B4BBB7B0067C7FE /* Debug */, 469 | 30C356ED1B4BBB7B0067C7FE /* Release */, 470 | ); 471 | defaultConfigurationIsVisible = 0; 472 | defaultConfigurationName = Release; 473 | }; 474 | 30C356EE1B4BBB7B0067C7FE /* Build configuration list for PBXNativeTarget "DYAlertPickerViewDemo" */ = { 475 | isa = XCConfigurationList; 476 | buildConfigurations = ( 477 | 30C356EF1B4BBB7B0067C7FE /* Debug */, 478 | 30C356F01B4BBB7B0067C7FE /* Release */, 479 | ); 480 | defaultConfigurationIsVisible = 0; 481 | defaultConfigurationName = Release; 482 | }; 483 | /* End XCConfigurationList section */ 484 | }; 485 | rootObject = 30C356C31B4BBB7B0067C7FE /* Project object */; 486 | } 487 | --------------------------------------------------------------------------------