├── Podfile ├── .swift-version ├── DSAlert-OC ├── DSAlertFrameWork.framework │ ├── _CodeSignature │ │ ├── CodeSignature │ │ ├── CodeDirectory │ │ ├── CodeRequirements │ │ ├── CodeRequirements-1 │ │ └── CodeResources │ ├── Info.plist │ ├── DSAlertFrameWork │ ├── DSTableCell~ipad.nib │ │ ├── runtime.nib │ │ └── objects-8.0+.nib │ ├── DSTableCell~iphone.nib │ │ ├── runtime.nib │ │ └── objects-8.0+.nib │ ├── Modules │ │ └── module.modulemap │ └── Headers │ │ ├── DSAlertFrameWork.h │ │ ├── DSActionSheet.h │ │ ├── DSAlert.h │ │ └── UIView+AutoLayout.h ├── 美女.jpg ├── 背景.jpg ├── 123.png ├── VerCodeAlertView.h ├── ViewController2.h ├── ViewController.h ├── AppDelegate.h ├── Alert6.h ├── main.m ├── VerCodeAlertView.m ├── DSAlert │ ├── DSTableCell.h │ ├── DSTableCell.m │ ├── CALayer+Animation.h │ ├── DSActionSheet.h │ ├── DSTableCell.xib │ ├── DSAlert.h │ ├── CALayer+Animation.m │ ├── DSActionSheet.m │ └── UIView+AutoLayout.h ├── Assets.xcassets │ └── AppIcon.appiconset │ │ └── Contents.json ├── Alert6.m ├── Info.plist ├── Base.lproj │ └── LaunchScreen.storyboard ├── ViewController2.m ├── AppDelegate.m ├── Main.storyboard ├── VerCodeAlertView.xib ├── Alert6.xib └── ViewController.m ├── DSAlert.gif ├── DSAlert-OC.xcodeproj ├── xcuserdata │ ├── luxiaofeng.xcuserdatad │ │ ├── xcdebugger │ │ │ └── Breakpoints_v2.xcbkptlist │ │ └── xcschemes │ │ │ ├── xcschememanagement.plist │ │ │ └── DSAlert-OC.xcscheme │ ├── boai.xcuserdatad │ │ ├── xcdebugger │ │ │ └── Breakpoints_v2.xcbkptlist │ │ └── xcschemes │ │ │ ├── xcschememanagement.plist │ │ │ └── DSAlert-OC.xcscheme │ └── cj.xcuserdatad │ │ └── xcschemes │ │ ├── xcschememanagement.plist │ │ └── DSAlert-OC.xcscheme ├── project.xcworkspace │ ├── contents.xcworkspacedata │ └── xcuserdata │ │ ├── cj.xcuserdatad │ │ └── UserInterfaceState.xcuserstate │ │ ├── boai.xcuserdatad │ │ └── UserInterfaceState.xcuserstate │ │ └── luxiaofeng.xcuserdatad │ │ └── UserInterfaceState.xcuserstate └── project.pbxproj ├── DSAlert-OC.podspec ├── LICENSE └── README.md /Podfile: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.swift-version: -------------------------------------------------------------------------------- 1 | 3.0 2 | -------------------------------------------------------------------------------- /DSAlert-OC/DSAlertFrameWork.framework/_CodeSignature/CodeSignature: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /DSAlert.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DS-Team/DSAlert-OC/HEAD/DSAlert.gif -------------------------------------------------------------------------------- /DSAlert-OC/美女.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DS-Team/DSAlert-OC/HEAD/DSAlert-OC/美女.jpg -------------------------------------------------------------------------------- /DSAlert-OC/背景.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DS-Team/DSAlert-OC/HEAD/DSAlert-OC/背景.jpg -------------------------------------------------------------------------------- /DSAlert-OC/123.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DS-Team/DSAlert-OC/HEAD/DSAlert-OC/123.png -------------------------------------------------------------------------------- /DSAlert-OC/DSAlertFrameWork.framework/Info.plist: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DS-Team/DSAlert-OC/HEAD/DSAlert-OC/DSAlertFrameWork.framework/Info.plist -------------------------------------------------------------------------------- /DSAlert-OC/DSAlertFrameWork.framework/DSAlertFrameWork: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DS-Team/DSAlert-OC/HEAD/DSAlert-OC/DSAlertFrameWork.framework/DSAlertFrameWork -------------------------------------------------------------------------------- /DSAlert-OC/DSAlertFrameWork.framework/_CodeSignature/CodeDirectory: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DS-Team/DSAlert-OC/HEAD/DSAlert-OC/DSAlertFrameWork.framework/_CodeSignature/CodeDirectory -------------------------------------------------------------------------------- /DSAlert-OC/DSAlertFrameWork.framework/_CodeSignature/CodeRequirements: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DS-Team/DSAlert-OC/HEAD/DSAlert-OC/DSAlertFrameWork.framework/_CodeSignature/CodeRequirements -------------------------------------------------------------------------------- /DSAlert-OC/DSAlertFrameWork.framework/DSTableCell~ipad.nib/runtime.nib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DS-Team/DSAlert-OC/HEAD/DSAlert-OC/DSAlertFrameWork.framework/DSTableCell~ipad.nib/runtime.nib -------------------------------------------------------------------------------- /DSAlert-OC/DSAlertFrameWork.framework/DSTableCell~iphone.nib/runtime.nib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DS-Team/DSAlert-OC/HEAD/DSAlert-OC/DSAlertFrameWork.framework/DSTableCell~iphone.nib/runtime.nib -------------------------------------------------------------------------------- /DSAlert-OC/DSAlertFrameWork.framework/_CodeSignature/CodeRequirements-1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DS-Team/DSAlert-OC/HEAD/DSAlert-OC/DSAlertFrameWork.framework/_CodeSignature/CodeRequirements-1 -------------------------------------------------------------------------------- /DSAlert-OC.xcodeproj/xcuserdata/luxiaofeng.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | -------------------------------------------------------------------------------- /DSAlert-OC/DSAlertFrameWork.framework/Modules/module.modulemap: -------------------------------------------------------------------------------- 1 | framework module DSAlertFrameWork { 2 | umbrella header "DSAlertFrameWork.h" 3 | 4 | export * 5 | module * { export * } 6 | } 7 | -------------------------------------------------------------------------------- /DSAlert-OC/DSAlertFrameWork.framework/DSTableCell~ipad.nib/objects-8.0+.nib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DS-Team/DSAlert-OC/HEAD/DSAlert-OC/DSAlertFrameWork.framework/DSTableCell~ipad.nib/objects-8.0+.nib -------------------------------------------------------------------------------- /DSAlert-OC/DSAlertFrameWork.framework/DSTableCell~iphone.nib/objects-8.0+.nib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DS-Team/DSAlert-OC/HEAD/DSAlert-OC/DSAlertFrameWork.framework/DSTableCell~iphone.nib/objects-8.0+.nib -------------------------------------------------------------------------------- /DSAlert-OC.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /DSAlert-OC.xcodeproj/project.xcworkspace/xcuserdata/cj.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DS-Team/DSAlert-OC/HEAD/DSAlert-OC.xcodeproj/project.xcworkspace/xcuserdata/cj.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /DSAlert-OC.xcodeproj/project.xcworkspace/xcuserdata/boai.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DS-Team/DSAlert-OC/HEAD/DSAlert-OC.xcodeproj/project.xcworkspace/xcuserdata/boai.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /DSAlert-OC.xcodeproj/project.xcworkspace/xcuserdata/luxiaofeng.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DS-Team/DSAlert-OC/HEAD/DSAlert-OC.xcodeproj/project.xcworkspace/xcuserdata/luxiaofeng.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /DSAlert-OC/VerCodeAlertView.h: -------------------------------------------------------------------------------- 1 | // 2 | // VerCodeAlertView.h 3 | // jijia_app_ios 4 | // 5 | // Created by cbs on 16/9/9. 6 | // Copyright © 2016年 CBS. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface VerCodeAlertView : UIView 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /DSAlert-OC/ViewController2.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController2.h 3 | // DSAlertDemo 4 | // 5 | // Created by boai on 16/8/31. 6 | // Copyright © 2016年 DS-Team. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ViewController2 : UIViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /DSAlert-OC/ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // DSAlert-OC 4 | // 5 | // Created by boai on 16/9/3. 6 | // Copyright © 2016年 DS-Team. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ViewController : UIViewController 12 | 13 | 14 | @end 15 | 16 | -------------------------------------------------------------------------------- /DSAlert-OC/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // DSAlert-OC 4 | // 5 | // Created by boai on 16/9/3. 6 | // Copyright © 2016年 DS-Team. 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 | -------------------------------------------------------------------------------- /DSAlert-OC/Alert6.h: -------------------------------------------------------------------------------- 1 | // 2 | // Alert6.h 3 | // DSAlert-OC 4 | // 5 | // Created by zeroLu on 16/9/8. 6 | // Copyright © 2016年 DS-Team. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface Alert6 : UIView 12 | 13 | + (instancetype)makeViewWithFrame:(CGRect)frame Title:(NSString *)title buttonTitles:(NSArray *)buttonTitles buttonBlock:(void (^)(NSInteger))block; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /DSAlert-OC/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // DSAlert-OC 4 | // 5 | // Created by boai on 16/9/3. 6 | // Copyright © 2016年 DS-Team. 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 | -------------------------------------------------------------------------------- /DSAlert-OC/VerCodeAlertView.m: -------------------------------------------------------------------------------- 1 | // 2 | // VerCodeAlertView.m 3 | // jijia_app_ios 4 | // 5 | // Created by cbs on 16/9/9. 6 | // Copyright © 2016年 CBS. All rights reserved. 7 | // 8 | 9 | #import "VerCodeAlertView.h" 10 | 11 | @implementation VerCodeAlertView 12 | 13 | /* 14 | // Only override drawRect: if you perform custom drawing. 15 | // An empty implementation adversely affects performance during animation. 16 | - (void)drawRect:(CGRect)rect { 17 | // Drawing code 18 | } 19 | */ 20 | 21 | @end 22 | -------------------------------------------------------------------------------- /DSAlert-OC.podspec: -------------------------------------------------------------------------------- 1 | Pod::Spec.new do |s| 2 | s.name = "DSAlert-OC" 3 | s.version = "1.0.2" 4 | s.summary = '目前为止,最为精简的 alert 和 actionSheet 封装!DSAlert 让你的弹框不再孤单!修复按钮标题数量与颜色数量不一致情况下崩溃的bug!' 5 | s.homepage = 'https://github.com/DS-Team/DSAlert-OC' 6 | s.license = 'MIT' 7 | s.authors = { 'DS-Team' => '513878863@qq.com' } 8 | s.platform = :ios, '7.0' 9 | s.source = { :git => 'https://github.com/DS-Team/DSAlert-OC.git', :tag => s.version.to_s } 10 | s.source_files = 'DSAlert-OC/DSAlert/*.{h,m}' 11 | s.requires_arc = true 12 | end 13 | -------------------------------------------------------------------------------- /DSAlert-OC.xcodeproj/xcuserdata/boai.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 8 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /DSAlert-OC.xcodeproj/xcuserdata/boai.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | DSAlert-OC.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | C4EA7C1D1D7AD19D00D790CA 16 | 17 | primary 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /DSAlert-OC.xcodeproj/xcuserdata/cj.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | DSAlert-OC.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | C4EA7C1D1D7AD19D00D790CA 16 | 17 | primary 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /DSAlert-OC.xcodeproj/xcuserdata/luxiaofeng.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | DSAlert-OC.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | C4EA7C1D1D7AD19D00D790CA 16 | 17 | primary 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /DSAlert-OC/DSAlertFrameWork.framework/Headers/DSAlertFrameWork.h: -------------------------------------------------------------------------------- 1 | // 2 | // DSAlertFrameWork.h 3 | // DSAlertFrameWork 4 | // 5 | // Created by boai on 16/9/7. 6 | // Copyright © 2016年 DS-Team. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | //! Project version number for DSAlertFrameWork. 12 | FOUNDATION_EXPORT double DSAlertFrameWorkVersionNumber; 13 | 14 | //! Project version string for DSAlertFrameWork. 15 | FOUNDATION_EXPORT const unsigned char DSAlertFrameWorkVersionString[]; 16 | 17 | // In this header, you should import all the public headers of your framework using statements like #import 18 | 19 | #import 20 | #import 21 | #import 22 | #import 23 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2016 DS-Team 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 | -------------------------------------------------------------------------------- /DSAlert-OC/DSAlert/DSTableCell.h: -------------------------------------------------------------------------------- 1 | 2 | /*! 3 | * @brief DSAlert-OC 4 | * 5 | * @author DS-Team 6 | * @copyright Copyright © 2016年 DS-Team. All rights reserved. 7 | * @version V1.0.0 8 | */ 9 | 10 | /* 11 | *************************** DSAlert 项目简介: ********************** 12 | 13 | 1、开发人员【DS-Team】: 14 | 孙博岩:[『https://github.com/boai』](https://github.com/boai)
15 | 陆晓峰:[『https://github.com/zeR0Lu』](https://github.com/zeR0Lu)
16 | 陈集 :[『https://github.com/chenjipdc』](https://github.com/chenjipdc) 17 | 2、项目源码地址: 18 | OC版 :https://github.com/DS-Team/DSAlert-OC 19 | swift版:https://github.com/DS-Team/DSAlert-swift 20 | 3、安装及使用方式: 21 | * 3.1、pod 导入【当前最新版本:1.0.0】: 22 | pod 'DSAlert' 23 | 导入头文件:#import 24 | * 3.2、下载demo,把 DSAlert 文件夹拖入项目即可, 25 | 导入头文件:#import "DSAlert.h" 26 | 4、如果开发中遇到特殊情况或者bug,请及时反馈给我们,谢谢! 27 | 5、也可以加入我们的大家庭:QQ群 【 479663605 】,希望广大小白和大神能够积极加入! 28 | 29 | */ 30 | 31 | 32 | #import 33 | 34 | static NSString *DSASCellIdentifier = @"DSTableCell"; 35 | 36 | @interface DSTableCell : UITableViewCell 37 | 38 | /*! 自定义图片 */ 39 | @property (weak, nonatomic) IBOutlet UIImageView *customImageView; 40 | /*! 自定义title */ 41 | @property (weak, nonatomic) IBOutlet UILabel *customTextLabel; 42 | 43 | 44 | @end 45 | -------------------------------------------------------------------------------- /DSAlert-OC/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 | "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 | } -------------------------------------------------------------------------------- /DSAlert-OC/Alert6.m: -------------------------------------------------------------------------------- 1 | // 2 | // Alert6.m 3 | // DSAlert-OC 4 | // 5 | // Created by zeroLu on 16/9/8. 6 | // Copyright © 2016年 DS-Team. All rights reserved. 7 | // 8 | 9 | #import "Alert6.h" 10 | 11 | @interface Alert6 () 12 | @property (weak, nonatomic) IBOutlet UILabel *titleLabel; 13 | @property (weak, nonatomic) IBOutlet UIButton *leftBtn; 14 | @property (weak, nonatomic) IBOutlet UIButton *rightBtn; 15 | 16 | @property (copy, nonatomic) void(^callback)(NSInteger index); 17 | @end 18 | 19 | @implementation Alert6 20 | 21 | + (instancetype)makeViewWithFrame:(CGRect)frame Title:(NSString *)title buttonTitles:(NSArray *)buttonTitles buttonBlock:(void (^)(NSInteger))block { 22 | Alert6 *view = [[[NSBundle mainBundle] loadNibNamed:NSStringFromClass([Alert6 class]) owner:self options:nil] firstObject]; 23 | view.frame = frame; 24 | [view setNeedsLayout]; 25 | 26 | view.titleLabel.text = title; 27 | if ( buttonTitles.count == 2 ) { 28 | [view.leftBtn setTitle:buttonTitles[0] forState:UIControlStateNormal]; 29 | [view.rightBtn setTitle:buttonTitles[1] forState:UIControlStateNormal]; 30 | view.leftBtn.tag = 1; 31 | view.rightBtn.tag = 2; 32 | }else { 33 | NSLog(@"按钮标题数要跟按钮个数一致"); 34 | } 35 | view.callback = block; 36 | return view; 37 | } 38 | 39 | - (IBAction)didButtonAction:(UIButton *)sender { 40 | if ( self.callback ) { 41 | self.callback(sender.tag); 42 | } 43 | } 44 | 45 | 46 | @end 47 | -------------------------------------------------------------------------------- /DSAlert-OC/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 | UISupportedInterfaceOrientations 34 | 35 | UIInterfaceOrientationPortrait 36 | UIInterfaceOrientationLandscapeLeft 37 | UIInterfaceOrientationLandscapeRight 38 | 39 | UISupportedInterfaceOrientations~ipad 40 | 41 | UIInterfaceOrientationPortrait 42 | UIInterfaceOrientationPortraitUpsideDown 43 | UIInterfaceOrientationLandscapeLeft 44 | UIInterfaceOrientationLandscapeRight 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /DSAlert-OC/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 | -------------------------------------------------------------------------------- /DSAlert-OC/DSAlert/DSTableCell.m: -------------------------------------------------------------------------------- 1 | 2 | /*! 3 | * @brief DSAlert-OC 4 | * 5 | * @author DS-Team 6 | * @copyright Copyright © 2016年 DS-Team. All rights reserved. 7 | * @version V1.0.0 8 | */ 9 | 10 | /* 11 | *************************** DSAlert 项目简介: ********************** 12 | 13 | 1、开发人员【DS-Team】: 14 | 孙博岩:[『https://github.com/boai』](https://github.com/boai)
15 | 陆晓峰:[『https://github.com/zeR0Lu』](https://github.com/zeR0Lu)
16 | 陈集 :[『https://github.com/chenjipdc』](https://github.com/chenjipdc) 17 | 2、项目源码地址: 18 | OC版 :https://github.com/DS-Team/DSAlert-OC 19 | swift版:https://github.com/DS-Team/DSAlert-swift 20 | 3、安装及使用方式: 21 | * 3.1、pod 导入【当前最新版本:1.0.0】: 22 | pod 'DSAlert' 23 | 导入头文件:#import 24 | * 3.2、下载demo,把 DSAlert 文件夹拖入项目即可, 25 | 导入头文件:#import "DSAlert.h" 26 | 4、如果开发中遇到特殊情况或者bug,请及时反馈给我们,谢谢! 27 | 5、也可以加入我们的大家庭:QQ群 【 479663605 】,希望广大小白和大神能够积极加入! 28 | 29 | */ 30 | 31 | 32 | #import "DSTableCell.h" 33 | 34 | @implementation DSTableCell 35 | 36 | - (void)awakeFromNib { 37 | [super awakeFromNib]; 38 | // Initialization code 39 | } 40 | 41 | - (void)setSelected:(BOOL)selected animated:(BOOL)animated { 42 | [super setSelected:selected animated:animated]; 43 | 44 | // Configure the view for the selected state 45 | } 46 | 47 | - (void)drawRect:(CGRect)rect { 48 | [super drawRect:rect]; 49 | 50 | CGContextRef context = UIGraphicsGetCurrentContext(); 51 | 52 | CGContextSetFillColorWithColor(context, [UIColor clearColor].CGColor); 53 | 54 | CGContextFillRect(context, rect); 55 | 56 | //下分割线 57 | 58 | CGContextSetStrokeColorWithColor(context,[UIColor colorWithWhite:0.8 alpha:1].CGColor); 59 | 60 | CGContextStrokeRect(context,CGRectMake(0, rect.size.height, rect.size.width, 0.5f)); 61 | } 62 | 63 | @end 64 | -------------------------------------------------------------------------------- /DSAlert-OC/ViewController2.m: -------------------------------------------------------------------------------- 1 | 2 | /*! 3 | * @brief DSAlert-OC 4 | * 5 | * @author DS-Team 6 | * @copyright Copyright © 2016年 DS-Team. All rights reserved. 7 | * @version V1.0.0 8 | */ 9 | 10 | /* 11 | *************************** DSAlert 项目简介: ********************** 12 | 13 | 1、开发人员【DS-Team】: 14 | 孙博岩:[『https://github.com/boai』](https://github.com/boai)
15 | 陆晓峰:[『https://github.com/zeR0Lu』](https://github.com/zeR0Lu)
16 | 陈集 :[『https://github.com/chenjipdc』](https://github.com/chenjipdc) 17 | 2、项目源码地址: 18 | OC版 :https://github.com/DS-Team/DSAlert-OC 19 | swift版:https://github.com/DS-Team/DSAlert-swift 20 | 3、安装及使用方式: 21 | * 3.1、pod 导入【当前最新版本:1.0.0】: 22 | pod 'DSAlert' 23 | 导入头文件:#import 24 | * 3.2、下载demo,把 DSAlert 文件夹拖入项目即可, 25 | 导入头文件:#import "DSAlert.h" 26 | 4、如果开发中遇到特殊情况或者bug,请及时反馈给我们,谢谢! 27 | 5、也可以加入我们的大家庭:QQ群 【 479663605 】,希望广大小白和大神能够积极加入! 28 | 29 | */ 30 | 31 | 32 | #import "ViewController2.h" 33 | //#import 34 | 35 | @interface ViewController2 () 36 | 37 | @end 38 | 39 | @implementation ViewController2 40 | 41 | - (void)viewDidLoad { 42 | [super viewDidLoad]; 43 | // Do any additional setup after loading the view. 44 | 45 | self.view.backgroundColor = [UIColor redColor]; 46 | 47 | } 48 | 49 | - (void)didReceiveMemoryWarning { 50 | [super didReceiveMemoryWarning]; 51 | // Dispose of any resources that can be recreated. 52 | } 53 | 54 | /* 55 | #pragma mark - Navigation 56 | 57 | // In a storyboard-based application, you will often want to do a little preparation before navigation 58 | - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { 59 | // Get the new view controller using [segue destinationViewController]. 60 | // Pass the selected object to the new view controller. 61 | } 62 | */ 63 | 64 | @end 65 | -------------------------------------------------------------------------------- /DSAlert-OC/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // DSAlert-OC 4 | // 5 | // Created by boai on 16/9/3. 6 | // Copyright © 2016年 DS-Team. 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 | -------------------------------------------------------------------------------- /DSAlert-OC/DSAlert/CALayer+Animation.h: -------------------------------------------------------------------------------- 1 | 2 | /*! 3 | * @brief DSAlert-OC 4 | * 5 | * @author DS-Team 6 | * @copyright Copyright © 2016年 DS-Team. All rights reserved. 7 | * @version V1.0.0 8 | */ 9 | 10 | /* 11 | *************************** DSAlert 项目简介: ********************** 12 | 13 | 1、开发人员【DS-Team】: 14 | 孙博岩:[『https://github.com/boai』](https://github.com/boai)
15 | 陆晓峰:[『https://github.com/zeR0Lu』](https://github.com/zeR0Lu)
16 | 陈集 :[『https://github.com/chenjipdc』](https://github.com/chenjipdc) 17 | 2、项目源码地址: 18 | OC版 :https://github.com/DS-Team/DSAlert-OC 19 | swift版:https://github.com/DS-Team/DSAlert-swift 20 | 3、安装及使用方式: 21 | * 3.1、pod 导入【当前最新版本:1.0.0】: 22 | pod 'DSAlert' 23 | 导入头文件:#import 24 | * 3.2、下载demo,把 DSAlert 文件夹拖入项目即可, 25 | 导入头文件:#import "DSAlert.h" 26 | 4、如果开发中遇到特殊情况或者bug,请及时反馈给我们,谢谢! 27 | 5、也可以加入我们的大家庭:QQ群 【 479663605 】,希望广大小白和大神能够积极加入! 28 | 29 | */ 30 | 31 | 32 | #import 33 | #import 34 | 35 | @interface CALayer (MyAnimation) 36 | /*! 37 | * 晃动动画 38 | * 39 | * @param duration 一次动画用时 40 | * @param radius 晃动角度0-180 41 | * @param repeat 重复次数 42 | * @param finish 动画完成 43 | */ 44 | - (void )shakeAnimationWithDuration:(NSTimeInterval )duration 45 | shakeRadius:(CGFloat )radius 46 | repeat:(NSUInteger )repeat 47 | finishAnimation:(void(^)()) finish; 48 | 49 | /*! 50 | * 根据路径执行动画 51 | * 52 | * @param duration 一次动画用时 53 | * @param path 路径CGPathRef 54 | * @param repeat 重复次数 55 | * @param finish 动画完成 56 | */ 57 | - (void )pathAnimationWithDuration:(NSTimeInterval )duration 58 | path:(CGPathRef )path 59 | repeat:(NSUInteger )repeat 60 | finishAnimation:(void(^)()) finish; 61 | 62 | 63 | /*! 这两个动画只适合本项目 */ 64 | /*! 天上掉下 */ 65 | - (void )fallAnimationWithDuration:(NSTimeInterval )duration 66 | finishAnimation:(void(^)()) finish; 67 | /*! 上升 */ 68 | - (void )floatAnimationWithDuration:(NSTimeInterval )duration 69 | finishAnimation:(void(^)()) finish; 70 | @end 71 | 72 | 73 | @interface UIView (MyAnimation) 74 | /*! 75 | * 缩放显示动画 76 | * 77 | * @param finish 动画完成 78 | */ 79 | 80 | - (void )scaleAnimationShowFinishAnimation:(void(^)()) finish; 81 | /*! 82 | * 缩放隐藏动画 83 | * 84 | * @param finish 动画完成 85 | */ 86 | - (void )scaleAnimationDismissFinishAnimation:(void(^)()) finish; 87 | 88 | @end -------------------------------------------------------------------------------- /DSAlert-OC/DSAlertFrameWork.framework/Headers/DSActionSheet.h: -------------------------------------------------------------------------------- 1 | 2 | /*! 3 | * @brief DSAlert-OC 4 | * 5 | * @author DS-Team 6 | * @copyright Copyright © 2016年 DS-Team. All rights reserved. 7 | * @version V1.0.0 8 | */ 9 | 10 | /* 11 | *************************** DSAlert 项目简介: ********************** 12 | 13 | 1、开发人员【DS-Team】: 14 | 孙博岩:[『https://github.com/boai』](https://github.com/boai)
15 | 陆晓峰:[『https://github.com/zeR0Lu』](https://github.com/zeR0Lu)
16 | 陈集 :[『https://github.com/chenjipdc』](https://github.com/chenjipdc) 17 | 2、项目源码地址: 18 | OC版 :https://github.com/DS-Team/DSAlert-OC 19 | swift版:https://github.com/DS-Team/DSAlert-swift 20 | 3、安装及使用方式: 21 | * 3.1、pod 导入【当前最新版本:1.0.0】: 22 | pod 'DSAlert' 23 | 导入头文件:#import 24 | * 3.2、下载demo,把 DSAlert 文件夹拖入项目即可, 25 | 导入头文件:#import "DSAlert.h" 26 | 4、如果开发中遇到特殊情况或者bug,请及时反馈给我们,谢谢! 27 | 5、也可以加入我们的大家庭:QQ群 【 479663605 】,希望广大小白和大神能够积极加入! 28 | 29 | */ 30 | 31 | 32 | 33 | #import 34 | 35 | #define SCREENWIDTH [UIScreen mainScreen].bounds.size.width 36 | #define SCREENHEIGHT [UIScreen mainScreen].bounds.size.height 37 | 38 | #define DSWeak __weak __typeof(self) weakSelf = self 39 | 40 | typedef NS_ENUM(NSInteger, DSCustomActionSheetStyle) { 41 | /*! 42 | * 普通样式 43 | */ 44 | DSCustomActionSheetStyleNormal = 1, 45 | /*! 46 | * 带标题样式 47 | */ 48 | DSCustomActionSheetStyleTitle, 49 | /*! 50 | * 带图片和标题样式 51 | */ 52 | DSCustomActionSheetStyleImageAndTitle, 53 | /*! 54 | * 带图片样式 55 | */ 56 | DSCustomActionSheetStyleImage, 57 | }; 58 | 59 | typedef void(^ButtonActionBlock)(NSInteger index); 60 | 61 | @interface DSActionSheet : UIView 62 | 63 | /*! 64 | * 65 | * @param style 样式 66 | * @param contentArray 选项数组(NSString数组) 67 | * @param imageArray 图片数组(UIImage数组) 68 | * @param redIndex 特别颜色的下标数组(NSNumber数组) 69 | * @param title 标题内容(可空) 70 | * @param clikckButtonIndex block回调点击的选项 71 | */ 72 | + (void)ds_showActionSheetWithStyle:(DSCustomActionSheetStyle)style 73 | contentArray:(NSArray *)contentArray 74 | imageArray:(NSArray *)imageArray 75 | redIndex:(NSInteger)redIndex 76 | title:(NSString *)title 77 | ClikckButtonIndex:(ButtonActionBlock)clikckButtonIndex; 78 | 79 | 80 | /*! 81 | * 隐藏 DSActionSheet 82 | */ 83 | - (void)ds_dismissDSActionSheet; 84 | @end 85 | -------------------------------------------------------------------------------- /DSAlert-OC/DSAlert/DSActionSheet.h: -------------------------------------------------------------------------------- 1 | 2 | /*! 3 | * @brief DSAlert-OC 4 | * 5 | * @author DS-Team 6 | * @copyright Copyright © 2016年 DS-Team. All rights reserved. 7 | * @version V1.0.0 8 | */ 9 | 10 | /* 11 | *************************** DSAlert 项目简介: ********************** 12 | 13 | 1、开发人员【DS-Team】: 14 | 孙博岩:[『https://github.com/boai』](https://github.com/boai)
15 | 陆晓峰:[『https://github.com/zeR0Lu』](https://github.com/zeR0Lu)
16 | 陈集 :[『https://github.com/chenjipdc』](https://github.com/chenjipdc) 17 | 2、项目源码地址: 18 | OC版 :https://github.com/DS-Team/DSAlert-OC 19 | swift版:https://github.com/DS-Team/DSAlert-swift 20 | 3、安装及使用方式: 21 | * 3.1、pod 导入【当前最新版本:1.0.0】: 22 | pod 'DSAlert' 23 | 导入头文件:#import 24 | * 3.2、下载demo,把 DSAlert 文件夹拖入项目即可, 25 | 导入头文件:#import "DSAlert.h" 26 | 4、如果开发中遇到特殊情况或者bug,请及时反馈给我们,谢谢! 27 | 5、也可以加入我们的大家庭:QQ群 【 479663605 】,希望广大小白和大神能够积极加入! 28 | 29 | */ 30 | 31 | 32 | 33 | #import 34 | 35 | #define SCREENWIDTH [UIScreen mainScreen].bounds.size.width 36 | #define SCREENHEIGHT [UIScreen mainScreen].bounds.size.height 37 | 38 | #define DSWeak __weak __typeof(self) weakSelf = self 39 | 40 | typedef NS_ENUM(NSInteger, DSCustomActionSheetStyle) { 41 | /*! 42 | * 普通样式 43 | */ 44 | DSCustomActionSheetStyleNormal = 1, 45 | /*! 46 | * 带标题样式 47 | */ 48 | DSCustomActionSheetStyleTitle, 49 | /*! 50 | * 带图片和标题样式 51 | */ 52 | DSCustomActionSheetStyleImageAndTitle, 53 | /*! 54 | * 带图片样式 55 | */ 56 | DSCustomActionSheetStyleImage, 57 | }; 58 | 59 | typedef void(^ButtonActionBlock)(NSInteger index); 60 | 61 | @interface DSActionSheet : UIView 62 | 63 | /*! 64 | * 65 | * @param style 样式 66 | * @param contentArray 选项数组(NSString数组) 67 | * @param imageArray 图片数组(UIImage数组) 68 | * @param redIndex 特别颜色的下标数组(NSNumber数组) 69 | * @param title 标题内容(可空) 70 | * @param clikckButtonIndex block回调点击的选项 71 | */ 72 | + (void)ds_showActionSheetWithStyle:(DSCustomActionSheetStyle)style 73 | contentArray:(NSArray *)contentArray 74 | imageArray:(NSArray *)imageArray 75 | redIndex:(NSInteger)redIndex 76 | title:(NSString *)title 77 | configuration:(void (^)(DSActionSheet *tempView)) configuration 78 | ClikckButtonIndex:(ButtonActionBlock)clikckButtonIndex; 79 | 80 | /*! 81 | * 隐藏 DSActionSheet 82 | */ 83 | - (void)ds_dismissDSActionSheet; 84 | 85 | @end 86 | -------------------------------------------------------------------------------- /DSAlert-OC.xcodeproj/xcuserdata/cj.xcuserdatad/xcschemes/DSAlert-OC.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 39 | 40 | 41 | 42 | 43 | 44 | 54 | 56 | 62 | 63 | 64 | 65 | 66 | 67 | 73 | 75 | 81 | 82 | 83 | 84 | 86 | 87 | 90 | 91 | 92 | -------------------------------------------------------------------------------- /DSAlert-OC.xcodeproj/xcuserdata/boai.xcuserdatad/xcschemes/DSAlert-OC.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 39 | 40 | 41 | 42 | 43 | 44 | 54 | 56 | 62 | 63 | 64 | 65 | 66 | 67 | 73 | 75 | 81 | 82 | 83 | 84 | 86 | 87 | 90 | 91 | 92 | -------------------------------------------------------------------------------- /DSAlert-OC.xcodeproj/xcuserdata/luxiaofeng.xcuserdatad/xcschemes/DSAlert-OC.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 39 | 40 | 41 | 42 | 43 | 44 | 54 | 56 | 62 | 63 | 64 | 65 | 66 | 67 | 73 | 75 | 81 | 82 | 83 | 84 | 86 | 87 | 90 | 91 | 92 | -------------------------------------------------------------------------------- /DSAlert-OC/DSAlert/DSTableCell.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /DSAlert-OC/DSAlertFrameWork.framework/Headers/DSAlert.h: -------------------------------------------------------------------------------- 1 | 2 | /*! 3 | * @brief DSAlert-OC 4 | * 5 | * @author DS-Team 6 | * @copyright Copyright © 2016年 DS-Team. All rights reserved. 7 | * @version V1.0.0 8 | */ 9 | 10 | /* 11 | *************************** DSAlert 项目简介: ********************** 12 | 13 | 1、开发人员【DS-Team】: 14 | 孙博岩:[『https://github.com/boai』](https://github.com/boai)
15 | 陆晓峰:[『https://github.com/zeR0Lu』](https://github.com/zeR0Lu)
16 | 陈集 :[『https://github.com/chenjipdc』](https://github.com/chenjipdc) 17 | 2、项目源码地址: 18 | OC版 :https://github.com/DS-Team/DSAlert-OC 19 | swift版:https://github.com/DS-Team/DSAlert-swift 20 | 3、安装及使用方式: 21 | * 3.1、pod 导入【当前最新版本:1.0.0】: 22 | pod 'DSAlert' 23 | 导入头文件:#import 24 | * 3.2、下载demo,把 DSAlert 文件夹拖入项目即可, 25 | 导入头文件:#import "DSAlert.h" 26 | 4、如果开发中遇到特殊情况或者bug,请及时反馈给我们,谢谢! 27 | 5、也可以加入我们的大家庭:QQ群 【 479663605 】,希望广大小白和大神能够积极加入! 28 | 29 | */ 30 | 31 | 32 | #import 33 | 34 | #define SCREENWIDTH [UIScreen mainScreen].bounds.size.width 35 | #define SCREENHEIGHT [UIScreen mainScreen].bounds.size.height 36 | 37 | #define DSWeak __weak __typeof(self) weakSelf = self 38 | 39 | 40 | /*! 背景高斯模糊枚举 默认:1 */ 41 | typedef NS_ENUM(NSInteger, DSAlertBlurEffectStyle) { 42 | /*! 较亮的白色模糊 */ 43 | DSAlertBlurEffectStyleExtraLight = 1, 44 | /*! 一般亮的白色模糊 */ 45 | DSAlertBlurEffectStyleLight, 46 | /*! 深色背景模糊 */ 47 | DSAlertBlurEffectStyleDark 48 | } NS_ENUM_AVAILABLE_IOS(7_0); 49 | 50 | /*! 进出场动画枚举 默认:1 */ 51 | typedef NS_ENUM(NSUInteger, DSAlertAnimatingStyle) { 52 | /*! 缩放显示动画 */ 53 | DSAlertAnimatingStyleScale = 1, 54 | /*! 晃动动画 */ 55 | DSAlertAnimatingStyleShake, 56 | /*! 天上掉下动画 / 上升动画 */ 57 | DSAlertAnimatingStyleFall, 58 | }; 59 | 60 | @interface DSAlert : UIView 61 | 62 | /*! 背景颜色 默认:半透明*/ 63 | @property (nonatomic, strong) UIColor *bgColor; 64 | 65 | /*! 按钮字体颜色 默认:白色*/ 66 | @property (nonatomic, strong) UIColor *buttonTitleColor; 67 | 68 | /*! 是否开启边缘触摸隐藏 alert 默认:NO */ 69 | @property (nonatomic, assign) BOOL isTouchEdgeHide; 70 | 71 | /*! 背景图片名字 默认:没有图片*/ 72 | @property (nonatomic, strong) NSString *bgImageName; 73 | 74 | /*! 是否开启进出场动画 默认:NO,如果 YES ,并且同步设置进出场动画枚举为默认值:1 */ 75 | @property (nonatomic, assign, getter=isShowAnimate) BOOL showAnimate; 76 | 77 | /*! 进出场动画枚举 默认:1 ,并且默认开启动画开关 */ 78 | @property (nonatomic, assign) DSAlertAnimatingStyle animatingStyle; 79 | 80 | /*! 背景高斯模糊枚举 默认:1 */ 81 | @property (nonatomic, assign) DSAlertBlurEffectStyle blurEffectStyle; 82 | 83 | /*! 84 | * 按钮点击事件回调 85 | */ 86 | @property (strong, nonatomic) void (^buttonActionBlock)(NSInteger index); 87 | 88 | /** 89 | * autoresizing的开关,如果在使用全自定义的方式而且使用autoresizing的情况下可以设置这个为true. 默认:false 90 | */ 91 | @property (assign, nonatomic) BOOL UseAutoresizing; 92 | 93 | 94 | #pragma mark - 1、高度封装一行即可完全配置alert,如不习惯,可使用第二种常用方法 95 | /*! 96 | * 创建一个完全自定义的 alertView 97 | * 98 | * @param customView 自定义 View 99 | * @param configuration 属性配置:如 bgColor、buttonTitleColor、isTouchEdgeHide... 100 | */ 101 | + (void)ds_showCustomView:(UIView *)customView 102 | configuration:(void (^)(DSAlert *tempView)) configuration; 103 | 104 | /*! 105 | * 创建一个类似于系统的alert 106 | * 107 | * @param title 标题:可空 108 | * @param message 消息内容:可空 109 | * @param image 图片:可空 110 | * @param buttonTitles 按钮标题:不可空 111 | * @param configuration 属性配置:如 bgColor、buttonTitleColor、isTouchEdgeHide... 112 | * @param action 按钮的点击事件处理 113 | */ 114 | + (void)ds_showAlertWithTitle:(NSString *)title 115 | message:(NSString *)message 116 | image:(UIImage *)image 117 | buttonTitles:(NSArray *)buttonTitles 118 | configuration:(void (^)(DSAlert *tempView)) configuration 119 | actionClick:(void (^)(NSInteger index)) action; 120 | 121 | #pragma mark - 2、常用方法 122 | /*! 123 | * 初始化自定义动画视图 124 | * @return instancetype 125 | */ 126 | - (instancetype)initWithCustomView:(UIView *)customView; 127 | 128 | /*! 129 | * 创建一个类似系统的警告框 130 | * 131 | * @param title title 132 | * @param message message 133 | * @param image image 134 | * @param buttonTitles 按钮的标题 135 | * 136 | * @return 创建一个类似系统的警告框 137 | */ 138 | - (instancetype)ds_showTitle:(NSString *)title 139 | message:(NSString *)message 140 | image:(UIImage *)image 141 | buttonTitles:(NSArray *)buttonTitles; 142 | 143 | /*! 144 | * 视图显示 145 | */ 146 | - (void)ds_showAlertView; 147 | 148 | /*! 149 | * 视图消失 150 | */ 151 | - (void)ds_dismissAlertView; 152 | 153 | 154 | @end 155 | -------------------------------------------------------------------------------- /DSAlert-OC/Main.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 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | -------------------------------------------------------------------------------- /DSAlert-OC/DSAlert/DSAlert.h: -------------------------------------------------------------------------------- 1 | 2 | /*! 3 | * @brief DSAlert-OC 4 | * 5 | * @author DS-Team 6 | * @copyright Copyright © 2016年 DS-Team. All rights reserved. 7 | * @version V1.0.0 8 | */ 9 | 10 | /* 11 | *************************** DSAlert 项目简介: ********************** 12 | 13 | 1、开发人员【DS-Team】: 14 | 孙博岩:[『https://github.com/boai』](https://github.com/boai)
15 | 陆晓峰:[『https://github.com/zeR0Lu』](https://github.com/zeR0Lu)
16 | 陈集 :[『https://github.com/chenjipdc』](https://github.com/chenjipdc) 17 | 2、项目源码地址: 18 | OC版 :https://github.com/DS-Team/DSAlert-OC 19 | swift版:https://github.com/DS-Team/DSAlert-swift 20 | 3、安装及使用方式: 21 | * 3.1、pod 导入【当前最新版本:1.0.0】: 22 | pod 'DSAlert' 23 | 导入头文件:#import 24 | * 3.2、下载demo,把 DSAlert 文件夹拖入项目即可, 25 | 导入头文件:#import "DSAlert.h" 26 | 4、如果开发中遇到特殊情况或者bug,请及时反馈给我们,谢谢! 27 | 5、也可以加入我们的大家庭:QQ群 【 479663605 】,希望广大小白和大神能够积极加入! 28 | 29 | */ 30 | 31 | 32 | #import 33 | 34 | #define SCREENWIDTH [UIScreen mainScreen].bounds.size.width 35 | #define SCREENHEIGHT [UIScreen mainScreen].bounds.size.height 36 | 37 | #define DSWeak __weak __typeof(self) weakSelf = self 38 | 39 | 40 | /*! 背景高斯模糊枚举 默认:1 */ 41 | typedef NS_ENUM(NSInteger, DSAlertBlurEffectStyle) { 42 | /*! 较亮的白色模糊 */ 43 | DSAlertBlurEffectStyleExtraLight = 1, 44 | /*! 一般亮的白色模糊 */ 45 | DSAlertBlurEffectStyleLight, 46 | /*! 深色背景模糊 */ 47 | DSAlertBlurEffectStyleDark 48 | } NS_ENUM_AVAILABLE_IOS(7_0); 49 | 50 | /*! 进出场动画枚举 默认:1 */ 51 | typedef NS_ENUM(NSUInteger, DSAlertAnimatingStyle) { 52 | /*! 缩放显示动画 */ 53 | DSAlertAnimatingStyleScale = 1, 54 | /*! 晃动动画 */ 55 | DSAlertAnimatingStyleShake, 56 | /*! 天上掉下动画 / 上升动画 */ 57 | DSAlertAnimatingStyleFall, 58 | }; 59 | 60 | @interface DSAlert : UIView 61 | 62 | /*! 背景颜色 默认:半透明*/ 63 | @property (nonatomic, strong) UIColor *bgColor; 64 | 65 | ///*! 按钮字体颜色 默认:白色*/ 66 | //@property (nonatomic, strong) UIColor *buttonTitleColor; 67 | 68 | /*! 是否开启边缘触摸隐藏 alert 默认:NO */ 69 | @property (nonatomic, assign) BOOL isTouchEdgeHide; 70 | 71 | /*! 背景图片名字 默认:没有图片*/ 72 | @property (nonatomic, strong) NSString *bgImageName; 73 | 74 | /*! 是否开启进出场动画 默认:NO,如果 YES ,并且同步设置进出场动画枚举为默认值:1 */ 75 | @property (nonatomic, assign, getter=isShowAnimate) BOOL showAnimate; 76 | 77 | /*! 进出场动画枚举 默认:1 ,并且默认开启动画开关 */ 78 | @property (nonatomic, assign) DSAlertAnimatingStyle animatingStyle; 79 | 80 | /*! 背景高斯模糊枚举 默认:1 */ 81 | @property (nonatomic, assign) DSAlertBlurEffectStyle blurEffectStyle; 82 | 83 | /*! 84 | * 按钮点击事件回调 85 | */ 86 | @property (strong, nonatomic) void (^buttonActionBlock)(NSInteger index); 87 | 88 | /** 89 | * autoresizing的开关,如果在使用全自定义的方式而且使用autoresizing的情况下可以设置这个为true. 默认:false 90 | */ 91 | @property (assign, nonatomic) BOOL UseAutoresizing; 92 | 93 | 94 | #pragma mark - 1、高度封装一行即可完全配置alert,如不习惯,可使用第二种常用方法 95 | /*! 96 | * 创建一个完全自定义的 alertView 97 | * 98 | * @param customView 自定义 View 99 | * @param configuration 属性配置:如 bgColor、buttonTitleColor、isTouchEdgeHide... 100 | */ 101 | + (void)ds_showCustomView:(UIView *)customView 102 | configuration:(void (^)(DSAlert *tempView)) configuration; 103 | 104 | /*! 105 | * 创建一个类似于系统的alert 106 | * 107 | * @param title 标题:可空 108 | * @param message 消息内容:可空 109 | * @param image 图片:可空 110 | * @param buttonTitles 按钮标题:不可空 111 | * @param buttonTitles 按钮标题颜色:可空,默认蓝色 112 | * @param configuration 属性配置:如 bgColor、buttonTitleColor、isTouchEdgeHide... 113 | * @param action 按钮的点击事件处理 114 | */ 115 | + (void)ds_showAlertWithTitle:(NSString *)title 116 | message:(NSString *)message 117 | image:(UIImage *)image 118 | buttonTitles:(NSArray *)buttonTitles 119 | buttonTitlesColor:(NSArray *)buttonTitlesColor 120 | configuration:(void (^)(DSAlert *tempView)) configuration 121 | actionClick:(void (^)(NSInteger index)) action; 122 | 123 | #pragma mark - 2、常用方法 124 | /*! 125 | * 初始化自定义动画视图 126 | * @return instancetype 127 | */ 128 | - (instancetype)initWithCustomView:(UIView *)customView; 129 | 130 | /*! 131 | * 创建一个类似系统的警告框 132 | * 133 | * @param title title 134 | * @param message message 135 | * @param image image 136 | * @param buttonTitles 按钮的标题 137 | * @param buttonTitles 按钮标题颜色:可空,默认蓝色 138 | * @return 创建一个类似系统的警告框 139 | */ 140 | - (instancetype)ds_showTitle:(NSString *)title 141 | message:(NSString *)message 142 | image:(UIImage *)image 143 | buttonTitles:(NSArray *)buttonTitles 144 | buttonTitlesColor:(NSArray *)buttonTitlesColor; 145 | 146 | /*! 147 | * 视图显示 148 | */ 149 | - (void)ds_showAlertView; 150 | 151 | /*! 152 | * 视图消失 153 | */ 154 | - (void)ds_dismissAlertView; 155 | 156 | 157 | @end 158 | -------------------------------------------------------------------------------- /DSAlert-OC/DSAlert/CALayer+Animation.m: -------------------------------------------------------------------------------- 1 | 2 | /*! 3 | * @brief DSAlert-OC 4 | * 5 | * @author DS-Team 6 | * @copyright Copyright © 2016年 DS-Team. All rights reserved. 7 | * @version V1.0.0 8 | */ 9 | 10 | /* 11 | *************************** DSAlert 项目简介: ********************** 12 | 13 | 1、开发人员【DS-Team】: 14 | 孙博岩:[『https://github.com/boai』](https://github.com/boai)
15 | 陆晓峰:[『https://github.com/zeR0Lu』](https://github.com/zeR0Lu)
16 | 陈集 :[『https://github.com/chenjipdc』](https://github.com/chenjipdc) 17 | 2、项目源码地址: 18 | OC版 :https://github.com/DS-Team/DSAlert-OC 19 | swift版:https://github.com/DS-Team/DSAlert-swift 20 | 3、安装及使用方式: 21 | * 3.1、pod 导入【当前最新版本:1.0.0】: 22 | pod 'DSAlert' 23 | 导入头文件:#import 24 | * 3.2、下载demo,把 DSAlert 文件夹拖入项目即可, 25 | 导入头文件:#import "DSAlert.h" 26 | 4、如果开发中遇到特殊情况或者bug,请及时反馈给我们,谢谢! 27 | 5、也可以加入我们的大家庭:QQ群 【 479663605 】,希望广大小白和大神能够积极加入! 28 | 29 | */ 30 | 31 | 32 | 33 | 34 | #import "CALayer+Animation.h" 35 | 36 | @implementation CALayer (MyAnimation) 37 | - (void )shakeAnimationWithDuration:(NSTimeInterval )duration 38 | shakeRadius:(CGFloat )radius 39 | repeat:(NSUInteger )repeat 40 | finishAnimation:(void(^)()) finish 41 | { 42 | CAKeyframeAnimation *keyAnimation = [CAKeyframeAnimation animation]; 43 | keyAnimation.duration = duration; 44 | keyAnimation.keyPath = @"transform.rotation.z"; 45 | keyAnimation.values = @[@((0) / 180.0 * M_PI),@((-radius) / 180.0 * M_PI),@((radius) / 180.0 * M_PI),@((-radius) / 180.0 * M_PI),@((0) / 180.0 * M_PI)]; 46 | keyAnimation.repeatCount = repeat; 47 | [self addAnimation:keyAnimation forKey:nil]; 48 | if (finish) 49 | { 50 | dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(duration * (CGFloat )repeat * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ 51 | finish(); 52 | }); 53 | } 54 | } 55 | 56 | - (void )pathAnimationWithDuration:(NSTimeInterval )duration 57 | path:(CGPathRef )path 58 | repeat:(NSUInteger )repeat 59 | finishAnimation:(void(^)()) finish 60 | { 61 | CAKeyframeAnimation *keyAnimation = [CAKeyframeAnimation animation]; 62 | keyAnimation.keyPath = @"position"; 63 | keyAnimation.duration = duration; 64 | keyAnimation.repeatCount = repeat; 65 | keyAnimation.fillMode = kCAFillModeForwards; 66 | keyAnimation.path = path; 67 | [self addAnimation:keyAnimation forKey:nil]; 68 | if (finish) 69 | { 70 | dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)((duration * (CGFloat )repeat - 0.1) * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ 71 | finish(); 72 | }); 73 | } 74 | } 75 | 76 | - (void )fallAnimationWithDuration:(NSTimeInterval )duration 77 | finishAnimation:(void(^)()) finish 78 | { 79 | CGRect frame = [UIScreen mainScreen].bounds; 80 | CGPoint center = CGPointMake(CGRectGetWidth(frame)*0.5, (CGRectGetHeight(frame) * 0.5)); 81 | CGPoint point = CGPointMake(CGRectGetWidth(frame)*0.5, -(CGRectGetHeight(self.frame))); 82 | UIBezierPath *path = [UIBezierPath bezierPath]; 83 | [path moveToPoint:point]; 84 | [path addLineToPoint:center]; 85 | 86 | [self pathAnimationWithDuration:duration path:path.CGPath repeat:1 finishAnimation:^{ 87 | if (finish) 88 | { 89 | finish(); 90 | } 91 | }]; 92 | } 93 | 94 | - (void )floatAnimationWithDuration:(NSTimeInterval )duration 95 | finishAnimation:(void(^)()) finish 96 | { 97 | CGRect frame = [UIScreen mainScreen].bounds; 98 | CGPoint center = CGPointMake(CGRectGetWidth(frame)*0.5, (CGRectGetHeight(frame) * 0.5)); 99 | CGPoint point = CGPointMake(CGRectGetWidth(frame)*0.5, -(CGRectGetHeight(self.frame))); 100 | UIBezierPath *path = [UIBezierPath bezierPath]; 101 | [path moveToPoint:center]; 102 | [path addLineToPoint:point]; 103 | 104 | [self pathAnimationWithDuration:duration path:path.CGPath repeat:1 finishAnimation:^{ 105 | if (finish) 106 | { 107 | finish(); 108 | } 109 | }]; 110 | } 111 | @end 112 | 113 | 114 | @implementation UIView(MyAnimation) 115 | 116 | 117 | - (void )scaleAnimationShowFinishAnimation:(void(^)()) finish 118 | { 119 | self.transform = CGAffineTransformMakeScale(0.001f, 0.001f); 120 | [UIView animateWithDuration:0.35f animations:^{ 121 | self.transform = CGAffineTransformMakeScale(1.18f, 1.18f); 122 | } completion:^(BOOL finished) { 123 | [UIView animateWithDuration:0.25f animations:^{ 124 | self.transform = CGAffineTransformMakeScale(1.0f, 1.0f); 125 | } completion:^(BOOL finished) { 126 | if (finish) { 127 | finish(); 128 | } 129 | }]; 130 | }]; 131 | } 132 | 133 | - (void )scaleAnimationDismissFinishAnimation:(void(^)()) finish 134 | { 135 | [UIView animateWithDuration:0.15f animations:^{ 136 | self.transform = CGAffineTransformMakeScale(1.18f, 1.18f); 137 | } completion:^(BOOL finished) { 138 | [UIView animateWithDuration:0.25f animations:^{ 139 | self.transform = CGAffineTransformMakeScale(0.0001f, 0.0001f); 140 | } completion:^(BOOL finished) { 141 | if (finish) { 142 | finish(); 143 | } 144 | }]; 145 | }]; 146 | } 147 | 148 | @end 149 | -------------------------------------------------------------------------------- /DSAlert-OC/DSAlertFrameWork.framework/_CodeSignature/CodeResources: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | files 6 | 7 | DSTableCell~ipad.nib/objects-8.0+.nib 8 | 9 | ybGdVD4saFf7ahSZjCQIir/XIdA= 10 | 11 | DSTableCell~ipad.nib/runtime.nib 12 | 13 | 55fm4lwvRfle1a2ijhTkvPR09QA= 14 | 15 | DSTableCell~iphone.nib/objects-8.0+.nib 16 | 17 | 2y2bzU3sAL1D588rDEIN7SBDWNA= 18 | 19 | DSTableCell~iphone.nib/runtime.nib 20 | 21 | MZroaEriKVtRcQcb2rzqBLZiQ3I= 22 | 23 | Headers/DSActionSheet.h 24 | 25 | ESqWTRYRrREGcTCO/IL203BgBeE= 26 | 27 | Headers/DSAlert.h 28 | 29 | iNKlhmlc6z64/twTdbdF4oiEIUg= 30 | 31 | Headers/DSAlertFrameWork.h 32 | 33 | T7p798l9M6V+sgMO4rHU0pcyJMQ= 34 | 35 | Headers/UIView+AutoLayout.h 36 | 37 | RgZKn+e92gJyx2aN3qBoUErCM50= 38 | 39 | Info.plist 40 | 41 | FUt1Jfw6cvHnFDKZTRRNAAAUzzQ= 42 | 43 | Modules/module.modulemap 44 | 45 | fgyZyYFNPv2hetJzSjax+Ss6uYE= 46 | 47 | 48 | files2 49 | 50 | DSTableCell~ipad.nib/objects-8.0+.nib 51 | 52 | hash 53 | 54 | ybGdVD4saFf7ahSZjCQIir/XIdA= 55 | 56 | hash2 57 | 58 | Bs2eMABoIBshWsK2SUeLoqVSaA8bcOGtY2EJE21FCNM= 59 | 60 | 61 | DSTableCell~ipad.nib/runtime.nib 62 | 63 | hash 64 | 65 | 55fm4lwvRfle1a2ijhTkvPR09QA= 66 | 67 | hash2 68 | 69 | ngVbHDt6poZou8J9ud5cWpjlpPAnGkX4EEETOqICKYg= 70 | 71 | 72 | DSTableCell~iphone.nib/objects-8.0+.nib 73 | 74 | hash 75 | 76 | 2y2bzU3sAL1D588rDEIN7SBDWNA= 77 | 78 | hash2 79 | 80 | BxhIdx9esIiCiwikxkV59mFE66SSsjhYqFl7Lpzo740= 81 | 82 | 83 | DSTableCell~iphone.nib/runtime.nib 84 | 85 | hash 86 | 87 | MZroaEriKVtRcQcb2rzqBLZiQ3I= 88 | 89 | hash2 90 | 91 | mhg0pWkdeZwIpD4lUomqzk7zbNOW39Oo9RzXgL9bWgM= 92 | 93 | 94 | Headers/DSActionSheet.h 95 | 96 | hash 97 | 98 | ESqWTRYRrREGcTCO/IL203BgBeE= 99 | 100 | hash2 101 | 102 | GFw4hto5odGPPu9HTgLfCxoXAO9dID5K1ugWvbPYiv0= 103 | 104 | 105 | Headers/DSAlert.h 106 | 107 | hash 108 | 109 | iNKlhmlc6z64/twTdbdF4oiEIUg= 110 | 111 | hash2 112 | 113 | 88RODf23bhMee3l/nT23Ez9kUKd5pgQmc42EhgWM0vk= 114 | 115 | 116 | Headers/DSAlertFrameWork.h 117 | 118 | hash 119 | 120 | T7p798l9M6V+sgMO4rHU0pcyJMQ= 121 | 122 | hash2 123 | 124 | UBolxFDA5OmB9QdaNpOwXUHX12rqGWzMa40SuKpMnfo= 125 | 126 | 127 | Headers/UIView+AutoLayout.h 128 | 129 | hash 130 | 131 | RgZKn+e92gJyx2aN3qBoUErCM50= 132 | 133 | hash2 134 | 135 | j6IH9YaoFkY+Kn+yK385+TWshoseqIQRZbpXwLNPoXo= 136 | 137 | 138 | Modules/module.modulemap 139 | 140 | hash 141 | 142 | fgyZyYFNPv2hetJzSjax+Ss6uYE= 143 | 144 | hash2 145 | 146 | +aHx+lUT2pWepSJCGXhwYG884NYx8AwrhkyHfOz8bqM= 147 | 148 | 149 | 150 | rules 151 | 152 | ^ 153 | 154 | ^.*\.lproj/ 155 | 156 | optional 157 | 158 | weight 159 | 1000 160 | 161 | ^.*\.lproj/locversion.plist$ 162 | 163 | omit 164 | 165 | weight 166 | 1100 167 | 168 | ^version.plist$ 169 | 170 | 171 | rules2 172 | 173 | .*\.dSYM($|/) 174 | 175 | weight 176 | 11 177 | 178 | ^ 179 | 180 | weight 181 | 20 182 | 183 | ^(.*/)?\.DS_Store$ 184 | 185 | omit 186 | 187 | weight 188 | 2000 189 | 190 | ^(Frameworks|SharedFrameworks|PlugIns|Plug-ins|XPCServices|Helpers|MacOS|Library/(Automator|Spotlight|LoginItems))/ 191 | 192 | nested 193 | 194 | weight 195 | 10 196 | 197 | ^.* 198 | 199 | ^.*\.lproj/ 200 | 201 | optional 202 | 203 | weight 204 | 1000 205 | 206 | ^.*\.lproj/locversion.plist$ 207 | 208 | omit 209 | 210 | weight 211 | 1100 212 | 213 | ^Info\.plist$ 214 | 215 | omit 216 | 217 | weight 218 | 20 219 | 220 | ^PkgInfo$ 221 | 222 | omit 223 | 224 | weight 225 | 20 226 | 227 | ^[^/]+$ 228 | 229 | nested 230 | 231 | weight 232 | 10 233 | 234 | ^embedded\.provisionprofile$ 235 | 236 | weight 237 | 20 238 | 239 | ^version\.plist$ 240 | 241 | weight 242 | 20 243 | 244 | 245 | 246 | 247 | -------------------------------------------------------------------------------- /DSAlert-OC/VerCodeAlertView.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 24 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | -------------------------------------------------------------------------------- /DSAlert-OC/Alert6.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 27 | 40 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | -------------------------------------------------------------------------------- /DSAlert-OC/DSAlert/DSActionSheet.m: -------------------------------------------------------------------------------- 1 | 2 | /*! 3 | * @brief DSAlert-OC 4 | * 5 | * @author DS-Team 6 | * @copyright Copyright © 2016年 DS-Team. All rights reserved. 7 | * @version V1.0.0 8 | */ 9 | 10 | /* 11 | *************************** DSAlert 项目简介: ********************** 12 | 13 | 1、开发人员【DS-Team】: 14 | 孙博岩:[『https://github.com/boai』](https://github.com/boai)
15 | 陆晓峰:[『https://github.com/zeR0Lu』](https://github.com/zeR0Lu)
16 | 陈集 :[『https://github.com/chenjipdc』](https://github.com/chenjipdc) 17 | 2、项目源码地址: 18 | OC版 :https://github.com/DS-Team/DSAlert-OC 19 | swift版:https://github.com/DS-Team/DSAlert-swift 20 | 3、安装及使用方式: 21 | * 3.1、pod 导入【当前最新版本:1.0.0】: 22 | pod 'DSAlert' 23 | 导入头文件:#import 24 | * 3.2、下载demo,把 DSAlert 文件夹拖入项目即可, 25 | 导入头文件:#import "DSAlert.h" 26 | 4、如果开发中遇到特殊情况或者bug,请及时反馈给我们,谢谢! 27 | 5、也可以加入我们的大家庭:QQ群 【 479663605 】,希望广大小白和大神能够积极加入! 28 | 29 | */ 30 | 31 | 32 | 33 | #import "DSActionSheet.h" 34 | #import "DSTableCell.h" 35 | 36 | @interface DSActionSheet () 37 | < 38 | UITableViewDelegate, 39 | UITableViewDataSource 40 | > 41 | /*! tableView */ 42 | @property (strong, nonatomic) UITableView *tableView; 43 | /*! 触摸背景消失 */ 44 | @property (strong, nonatomic) UIControl *overlayControl; 45 | /*! 数据源 */ 46 | @property (strong, nonatomic) NSArray *dataArray; 47 | /*! 图片数组 */ 48 | @property (strong, nonatomic) NSArray *imageArray; 49 | /*! 标记颜色是红色的那行 */ 50 | @property (assign, nonatomic) NSInteger specialIndex; 51 | /*! 标题 */ 52 | @property (copy, nonatomic ) NSString *title; 53 | /*! 点击事件回调 */ 54 | @property (copy, nonatomic) void(^callback)(NSInteger index); 55 | /*! 自定义样式 */ 56 | @property (assign, nonatomic) DSCustomActionSheetStyle viewStyle; 57 | 58 | @end 59 | 60 | @implementation DSActionSheet 61 | 62 | + (instancetype)shareActionSheet 63 | { 64 | DSActionSheet *actionSheet = [[self alloc] init]; 65 | actionSheet.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin|UIViewAutoresizingFlexibleRightMargin|UIViewAutoresizingFlexibleBottomMargin; 66 | return actionSheet; 67 | } 68 | 69 | /*! 70 | * 71 | * @param style 样式 72 | * @param contentArray 选项数组(NSString数组) 73 | * @param imageArray 图片数组(UIImage数组) 74 | * @param redIndex 特别颜色的下标数组(NSNumber数组) 75 | * @param title 标题内容(可空) 76 | * @param clikckButtonIndex block回调点击的选项 77 | */ 78 | + (void)ds_showActionSheetWithStyle:(DSCustomActionSheetStyle)style 79 | contentArray:(NSArray *)contentArray 80 | imageArray:(NSArray *)imageArray 81 | redIndex:(NSInteger)redIndex 82 | title:(NSString *)title 83 | configuration:(void (^)(DSActionSheet *tempView)) configuration 84 | ClikckButtonIndex:(ButtonActionBlock)clikckButtonIndex 85 | { 86 | DSActionSheet *actionSheet = [self shareActionSheet]; 87 | actionSheet.dataArray = contentArray; 88 | actionSheet.callback = clikckButtonIndex; 89 | actionSheet.viewStyle = style; 90 | actionSheet.imageArray = imageArray; 91 | actionSheet.specialIndex = redIndex; 92 | actionSheet.title = title; 93 | if (configuration) 94 | { 95 | configuration(actionSheet); 96 | } 97 | [actionSheet.tableView reloadData]; 98 | [actionSheet show]; 99 | } 100 | 101 | #pragma mark - UITableView 102 | - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView 103 | { 104 | return 2; 105 | } 106 | 107 | - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section 108 | { 109 | if ( 0 == section ) 110 | { 111 | if ( self.viewStyle == DSCustomActionSheetStyleNormal || self.viewStyle == DSCustomActionSheetStyleImage ) 112 | { 113 | return self.dataArray.count; 114 | } 115 | else 116 | { 117 | return self.dataArray.count + 1; 118 | } 119 | } 120 | else 121 | { 122 | return 1; 123 | } 124 | } 125 | 126 | - (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section 127 | { 128 | return (section == 0)?8.f:0.1f; 129 | } 130 | 131 | - (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section 132 | { 133 | return 0.1f; 134 | } 135 | 136 | - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath 137 | { 138 | DSTableCell *cell = [tableView dequeueReusableCellWithIdentifier:DSASCellIdentifier forIndexPath:indexPath]; 139 | cell.selectionStyle = (self.title)?UITableViewCellSelectionStyleNone:UITableViewCellSelectionStyleDefault; 140 | if ( 0 == indexPath.section ) 141 | { 142 | if ( indexPath.row == self.specialIndex ) 143 | { 144 | cell.customTextLabel.textColor = [UIColor redColor]; 145 | } 146 | 147 | if ( self.viewStyle == DSCustomActionSheetStyleNormal ) 148 | { 149 | cell.customTextLabel.text = self.dataArray[indexPath.row]; 150 | } 151 | else if ( self.viewStyle == DSCustomActionSheetStyleTitle ) 152 | { 153 | cell.customTextLabel.text = (indexPath.row ==0) ? self.title : self.dataArray[indexPath.row-1]; 154 | } 155 | else 156 | { 157 | 158 | NSInteger index = (self.title) ? indexPath.row - 1 : indexPath.row; 159 | if ( index >= 0 ) 160 | { 161 | cell.customImageView.image = self.imageArray[index]; 162 | } 163 | 164 | cell.customTextLabel.text = (indexPath.row == 0) ? self.title : self.dataArray[indexPath.row-1]; 165 | } 166 | } 167 | else 168 | { 169 | cell.customTextLabel.text = @"取 消"; 170 | } 171 | return cell; 172 | } 173 | 174 | - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath 175 | { 176 | if ( 0 == indexPath.section ) 177 | { 178 | NSInteger index = 0; 179 | if ( self.viewStyle == DSCustomActionSheetStyleNormal || self.viewStyle == DSCustomActionSheetStyleImage ) 180 | { 181 | index = indexPath.row; 182 | } 183 | else 184 | { 185 | index = indexPath.row - 1; 186 | } 187 | if (-1 == index) 188 | { 189 | NSLog(@"【 DSActionSheet 】标题不能点击!"); 190 | return; 191 | } 192 | self.callback(index); 193 | } 194 | else if ( 1 == indexPath.section ) 195 | { 196 | NSLog(@"【 DSActionSheet 】你点击了取消按钮!"); 197 | [self fadeOut]; 198 | } 199 | [tableView deselectRowAtIndexPath:indexPath animated:YES]; 200 | } 201 | 202 | #pragma mark - UpdateFrame 203 | - (void)fadeIn 204 | { 205 | CGFloat tableViewHeight = MIN(SCREENHEIGHT - 64.f, self.tableView.contentSize.height); 206 | self.tableView.frame = CGRectMake(0.f, 0.f, SCREENWIDTH, tableViewHeight); 207 | 208 | self.frame = CGRectMake(0.f, SCREENHEIGHT, SCREENWIDTH, tableViewHeight); 209 | DSWeak; 210 | [UIView animateWithDuration:.25f animations:^{ 211 | weakSelf.frame = CGRectMake(0.f, SCREENHEIGHT - tableViewHeight, SCREENWIDTH, tableViewHeight); 212 | }]; 213 | } 214 | 215 | - (void)fadeOut 216 | { 217 | DSWeak; 218 | [UIView animateWithDuration:.25f animations:^{ 219 | weakSelf.frame = CGRectMake(0.f, SCREENHEIGHT, SCREENWIDTH, CGRectGetHeight(weakSelf.frame)); 220 | } completion:^(BOOL finished) { 221 | if (finished) { 222 | [weakSelf.overlayControl removeFromSuperview]; 223 | weakSelf.overlayControl = nil; 224 | [weakSelf removeFromSuperview]; 225 | } 226 | }]; 227 | } 228 | 229 | - (void)layoutSubviews 230 | { 231 | 232 | [super layoutSubviews]; 233 | 234 | CGFloat tableViewHeight = MIN(SCREENHEIGHT - 64.f, self.tableView.contentSize.height); 235 | self.tableView.frame = CGRectMake(0.f, 0.f, SCREENWIDTH, tableViewHeight); 236 | self.frame = CGRectMake(0.f, SCREENHEIGHT - tableViewHeight, SCREENWIDTH, tableViewHeight); 237 | } 238 | 239 | - (void)show 240 | { 241 | UIWindow *keywindow = [[UIApplication sharedApplication] keyWindow]; 242 | [keywindow addSubview:self.overlayControl]; 243 | [keywindow addSubview:self]; 244 | [self fadeIn]; 245 | } 246 | 247 | - (void)ds_dismissDSActionSheet 248 | { 249 | NSLog(@"【 DSActionSheet 】你触摸了背景隐藏!"); 250 | [self fadeOut]; 251 | } 252 | 253 | #pragma mark - lazy 254 | - (UITableView *)tableView 255 | { 256 | if ( !_tableView ) 257 | { 258 | _tableView = [[UITableView alloc] initWithFrame:CGRectZero style:UITableViewStyleGrouped]; 259 | _tableView.delegate = self; 260 | _tableView.dataSource = self; 261 | _tableView.scrollEnabled = NO; 262 | _tableView.separatorStyle = UITableViewCellSeparatorStyleNone; 263 | _tableView.backgroundColor = [UIColor colorWithWhite:0.9 alpha:1.f]; 264 | [self addSubview:_tableView]; 265 | [_tableView registerNib:[UINib nibWithNibName:DSASCellIdentifier bundle:nil] forCellReuseIdentifier:DSASCellIdentifier]; 266 | } 267 | return _tableView; 268 | } 269 | 270 | - (UIControl *)overlayControl 271 | { 272 | if ( !_overlayControl ) 273 | { 274 | _overlayControl = [[UIControl alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; 275 | _overlayControl.backgroundColor = [UIColor colorWithRed:.16 green:.17 blue:.21 alpha:.5]; 276 | [_overlayControl addTarget:self action:@selector(ds_dismissDSActionSheet) forControlEvents:UIControlEventTouchUpInside]; 277 | _overlayControl.autoresizingMask = UIViewAutoresizingFlexibleWidth|UIViewAutoresizingFlexibleHeight|UIViewAutoresizingFlexibleLeftMargin|UIViewAutoresizingFlexibleRightMargin|UIViewAutoresizingFlexibleBottomMargin; 278 | } 279 | return _overlayControl; 280 | } 281 | 282 | @end 283 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | #DSAlert 2 | 目前为止,最为精简的 alert 和 actionSheet 封装!DSAlert 让你的弹框不再孤单! 3 | 4 | --- 5 | 6 | ## 更新提示:【倒叙更新】 7 | 8 | #### version 1.0.1 9 | * 12、终于可以愉快的 pod 导入了,pod 导入:` pod 'DSAlert-OC' ` 【最新版本:1.0.8】 10 | * 11、可以自定义每个按钮的字体颜色了! 11 | * 10、再次设计结构,新增frameWork静态库文件封装,喜欢简洁的你可以直接导入frameWork即可! 12 | * 9、多种炫酷入场、退出动画,让你的APP各种叼! 13 | * 8、新增高斯模糊,枚举选择,简单明了! 14 | * 7、新增是否开启边缘触摸隐藏 alert 默认:关闭,属性:isTouchEdgeHide,可自由开关边缘触摸! 15 | * 6、完美适配横竖屏 16 | * 5、简单的两行搞定一个自定义 alert 17 | * 4、手势触摸隐藏 18 | * 3、可以自定义背景图片、按钮颜色 19 | * 2、可以添加文字和图片,且可以滑动查看 20 | * 1、理论完全兼容目前所有 iOS 系统版本 21 | 22 | --- 23 | 24 | ## 0、安装、导入示例和源码地址: 25 | * 0.1、pod 导入:` pod 'DSAlert-OC' ` 【最新版本:1.0.8】 26 | * 0.2、使用方法2:下载demo,把 DSAlert 文件夹拖入项目即可,
27 | 导入头文件:
28 | ` #import "DSAlert.h" `
29 | 如果使用 DSActionSheet 需导入头文件:
30 | `#import "DSActionSheet.h"` 31 | * 0.3、使用方法3:frameWork ,把demo中的frameWork直接拖入项目即可
32 | `#import ` 33 | * 0.4、项目源码地址:
34 | OC版 :[https://github.com/DS-Team/DSAlert-OC](https://github.com/DS-Team/DSAlert-OC)
35 | swift 版:[https://github.com/DS-Team/DSAlert-swift](https://github.com/DS-Team/DSAlert-swift) 36 | 37 | #### 注:swift 版正在调试,稍后上传! 38 | 39 | --- 40 | 41 | ## 1、图片示例: 42 | 43 | ![DSAlert.gif](https://github.com/DS-Team/DSAlert-OC/blob/master/DSAlert.gif) 44 | 45 | --- 46 | 47 | ## 2、代码示例: 48 | * 2.1 类似系统 alert【加边缘手势消失】、高斯模糊背景 49 | 50 | ``` 51 | - (void)alert1 52 | { 53 | DSWeak; 54 | /*! 第一种封装使用示例 */ 55 | [DSAlert ds_showAlertWithTitle:@"温馨提示:" message:titleMsg1 image:nil buttonTitles:@[@"取消",@"确定"] configuration:^(DSAlert *temp) { 56 | 57 | // temp.bgColor = [UIColor colorWithRed:0 green:1.0 blue:0 alpha:0.3]; 58 | /*! 开启边缘触摸隐藏alertView */ 59 | temp.isTouchEdgeHide = YES; 60 | /*! 添加高斯模糊的样式 */ 61 | temp.blurEffectStyle = DSAlertBlurEffectStyleLight; 62 | /*! 开启动画 */ 63 | // temp.isShowAnimate = YES; 64 | // /*! 进出场动画样式 默认为:1 */ 65 | // temp.animatingStyle = 1; 66 | }actionClick:^(NSInteger index) { 67 | if (index == 0) 68 | { 69 | NSLog(@"点击了取消按钮!"); 70 | /*! 隐藏alert */ 71 | // [weakSelf.alertView1 ds_dismissAlertView]; 72 | } 73 | else if (index == 1) 74 | { 75 | NSLog(@"点击了确定按钮!"); 76 | ViewController2 *vc2 = [ViewController2 new]; 77 | vc2.title = @"alert1"; 78 | [weakSelf.navigationController pushViewController:vc2 animated:YES]; 79 | /*! 隐藏alert */ 80 | // [weakSelf.alertView1 ds_dismissAlertView]; 81 | } 82 | }]; 83 | } 84 | ``` 85 | 86 | * 2.2 自定义按钮颜色 87 | 88 | ``` 89 | - (void)alert2 90 | { 91 | /*! 2、自定义按钮颜色 */ 92 | _alertView2 = [[DSAlert alloc] ds_showTitle:@"温馨提示:" 93 | message:titleMsg2 94 | image:nil 95 | buttonTitles:@[@"取消", @"跳转VC2"]]; 96 | /*! 自定义按钮文字颜色 */ 97 | _alertView2.buttonTitleColor = [UIColor orangeColor]; 98 | _alertView2.bgColor = [UIColor colorWithRed:1.0 green:1.0 blue:0 alpha:0.3]; 99 | 100 | /*! 是否开启进出场动画 默认:NO,如果 YES ,并且同步设置进出场动画枚举为默认值:1 */ 101 | _alertView2.showAnimate = YES; 102 | 103 | /*! 显示alert */ 104 | [_alertView2 ds_showAlertView]; 105 | DSWeak; 106 | _alertView2.buttonActionBlock = ^(NSInteger index){ 107 | if (index == 0) 108 | { 109 | NSLog(@"点击了取消按钮!"); 110 | /*! 隐藏alert */ 111 | [weakSelf.alertView2 ds_dismissAlertView]; 112 | } 113 | else if (index == 1) 114 | { 115 | NSLog(@"点击了确定按钮!"); 116 | ViewController2 *vc2 = [ViewController2 new]; 117 | vc2.title = @"alert2"; 118 | [weakSelf.navigationController pushViewController:vc2 animated:YES]; 119 | /*! 隐藏alert */ 120 | // [weakSelf.alertView2 ds_dismissAlertView]; 121 | } 122 | }; 123 | } 124 | ``` 125 | 126 | * 2.3 自定义背景图片 127 | 128 | ``` 129 | - (void)alert3 130 | { 131 | /*! 3、自定义背景图片 */ 132 | _alertView3 = [[DSAlert alloc] ds_showTitle:@"温馨提示:" 133 | message:titleMsg1 134 | image:nil 135 | buttonTitles:@[@"取消", @"确定"]]; 136 | /*! 自定义按钮文字颜色 */ 137 | _alertView3.buttonTitleColor = [UIColor orangeColor]; 138 | /*! 自定义alert的背景图片 */ 139 | _alertView3.bgImageName = @"背景.jpg"; 140 | /*! 开启动画,并且设置动画样式,默认:1 */ 141 | // _alertView3.isShowAnimate = YES; 142 | 143 | /*! 没有开启动画,直接进出场动画样式,默认开启动画 */ 144 | _alertView3.animatingStyle = DSAlertAnimatingStyleFall; 145 | 146 | /*! 显示alert */ 147 | [_alertView3 ds_showAlertView]; 148 | DSWeak; 149 | _alertView3.buttonActionBlock = ^(NSInteger index){ 150 | if (index == 0) 151 | { 152 | NSLog(@"点击了取消按钮!"); 153 | /*! 隐藏alert */ 154 | // [weakSelf.alertView3 ds_dismissAlertView]; 155 | } 156 | else if (index == 1) 157 | { 158 | NSLog(@"点击了确定按钮!"); 159 | ViewController2 *vc2 = [ViewController2 new]; 160 | vc2.title = @"alert3"; 161 | [weakSelf.navigationController pushViewController:vc2 animated:YES]; 162 | /*! 隐藏alert */ 163 | // [weakSelf.alertView3 ds_dismissAlertView]; 164 | } 165 | }; 166 | } 167 | ``` 168 | 169 | * 2.4 内置图片和文字,可滑动查看 170 | 171 | ``` 172 | - (void)alert4 173 | { 174 | /*! 4、内置图片和文字,可滑动查看 */ 175 | _alertView4 = [[DSAlert alloc] ds_showTitle:@"温馨提示:" 176 | message:titleMsg1 177 | image:[UIImage imageNamed:@"美女.jpg"] 178 | buttonTitles:@[@"取消", @"跳转VC2"]]; 179 | /*! 自定义按钮文字颜色 */ 180 | _alertView4.buttonTitleColor = [UIColor orangeColor]; 181 | /*! 自定义alert的背景图片 */ 182 | _alertView4.bgImageName = @"背景.jpg"; 183 | /*! 是否显示动画效果 */ 184 | _alertView4.showAnimate = YES; 185 | /*! 显示alert */ 186 | [_alertView4 ds_showAlertView]; 187 | DSWeak; 188 | _alertView4.buttonActionBlock = ^(NSInteger index){ 189 | if (index == 0) 190 | { 191 | NSLog(@"点击了取消按钮!"); 192 | /*! 隐藏alert */ 193 | // [weakSelf.alertView4 ds_dismissAlertView]; 194 | } 195 | else if (index == 1) 196 | { 197 | NSLog(@"点击了确定按钮!"); 198 | ViewController2 *vc2 = [ViewController2 new]; 199 | vc2.title = @"alert4"; 200 | [weakSelf.navigationController pushViewController:vc2 animated:YES]; 201 | /*! 隐藏alert */ 202 | // [weakSelf.alertView4 ds_dismissAlertView]; 203 | } 204 | }; 205 | } 206 | ``` 207 | 208 | * 2.5 完全自定义alert 209 | 210 | ``` 211 | - (void)alert5 212 | { 213 | /*! 5、完全自定义alert */ 214 | UIView *view1 = [UIView new]; 215 | view1.frame = CGRectMake(30, 100, SCREENWIDTH - 60, 200); 216 | view1.backgroundColor = [UIColor yellowColor]; 217 | view1.layer.masksToBounds = YES; 218 | view1.layer.cornerRadius = 10.0f; 219 | // view1.clipsToBounds = YES; 220 | 221 | _titleLabel = [UILabel new]; 222 | _titleLabel.frame = CGRectMake(0, 0, view1.frame.size.width, 40); 223 | _titleLabel.text = @"测试title"; 224 | _titleLabel.textAlignment = NSTextAlignmentCenter; 225 | _titleLabel.font = [UIFont systemFontOfSize:18]; 226 | _titleLabel.backgroundColor = [UIColor greenColor]; 227 | [view1 addSubview:_titleLabel]; 228 | _titleLabel.autoresizingMask = UIViewAutoresizingFlexibleWidth; 229 | 230 | _chooseBtn = [[UIButton alloc]initWithFrame:CGRectMake(0, view1.frame.size.height - 40, view1.frame.size.width, 40)]; 231 | // _chooseBtn = [UIButton buttonWithType:UIButtonTypeCustom]; 232 | [_chooseBtn setTitle:@"取消" forState:UIControlStateNormal]; 233 | [_chooseBtn setBackgroundColor:[UIColor redColor]]; 234 | [_chooseBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; 235 | [_chooseBtn addTarget:self action:@selector(cancleButtonAction:) forControlEvents:UIControlEventTouchUpInside]; 236 | [view1 addSubview:_chooseBtn]; 237 | _chooseBtn.autoresizingMask = UIViewAutoresizingFlexibleWidth; 238 | 239 | _alertView5 = [[DSAlert alloc] initWithCustomView:view1]; 240 | _alertView5.showAnimate = YES; 241 | [_alertView5 ds_showAlertView]; 242 | } 243 | 244 | - (void)cancleButtonAction:(UIButton *)sender 245 | { 246 | NSLog(@"点击了取消按钮!"); 247 | /*! 隐藏alert */ 248 | [_alertView5 ds_dismissAlertView]; 249 | } 250 | ``` 251 | 252 | * 2.6 actionsheet 253 | 254 | ``` 255 | [DSActionSheet ds_showActionSheetWithStyle:DSCustomActionSheetStyleNormal 256 | contentArray:@[@"测试1",@"测试2",@"测试3"] 257 | imageArray:nil 258 | redIndex:1 259 | title:nil 260 | ClikckButtonIndex:^(NSInteger index) { 261 | NSLog(@"你点击了第 %ld 行!",(long)index); 262 | }]; 263 | ``` 264 | 265 | * 2.7 actionsheet带标题 266 | 267 | ``` 268 | [DSActionSheet ds_showActionSheetWithStyle:DSCustomActionSheetStyleTitle 269 | contentArray:@[@"测试1",@"测试2",@"测试3"] 270 | imageArray:nil 271 | redIndex:1 272 | title:@"测试带标题的ActionSheet" 273 | ClikckButtonIndex:^(NSInteger index) { 274 | NSLog(@"你点击了第 %ld 行!",(long)index); 275 | }]; 276 | ``` 277 | 278 | * 2.8 actionsheet带标题带图片 279 | 280 | ``` 281 | [DSActionSheet ds_showActionSheetWithStyle:DSCustomActionSheetStyleImageAndTitle 282 | contentArray:@[@"测试1",@"测试2",@"测试3"] 283 | imageArray:@[[UIImage imageNamed:@"123.png"],[UIImage imageNamed:@"背景.jpg"],[UIImage imageNamed:@"美女.jpg"]] 284 | redIndex:1 285 | title:@"测试带标题和图片的ActionSheet" 286 | ClikckButtonIndex:^(NSInteger index) { 287 | NSLog(@"你点击了第 %ld 行!",(long)index); 288 | }]; 289 | ``` 290 | 291 | ## 3、DS-Team 简介 292 | DS-Team 是一个自发组织的民间团队,成立于2016年,致力于 iOS 最简洁的封装和最新技术的研发,一般都有 OC 和 swift 版本,后期会推出其他语言版本。 293 | 294 | 为解决广大小白项目中遇到的各种疑难杂症,小伙伴儿们可以加入我们的QQ群 `479663605`,希望广大小白和大神能够积极加入! 295 | 296 | 297 | ## 4、系统要求 298 | 299 | 该项目最低支持 iOS 7.0 和 Xcode 7.2(swift 版本只支持Xcode 7.3及以上版本),理论支持目前所有 iOS 系统版本! 300 | 301 | --- 302 | 303 | 304 | 305 | 306 | 307 | 308 | -------------------------------------------------------------------------------- /DSAlert-OC/DSAlert/UIView+AutoLayout.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIView+AutoLayout.h 3 | // v2.0.0 4 | // https://github.com/smileyborg/UIView-AutoLayout 5 | // 6 | // Copyright (c) 2012 Richard Turton 7 | // Copyright (c) 2013 Tyler Fox 8 | // 9 | // This code is distributed under the terms and conditions of the MIT license. 10 | // 11 | // Permission is hereby granted, free of charge, to any person obtaining a copy 12 | // of this software and associated documentation files (the "Software"), to 13 | // deal in the Software without restriction, including without limitation the 14 | // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 15 | // sell copies of the Software, and to permit persons to whom the Software is 16 | // furnished to do so, subject to the following conditions: 17 | // 18 | // The above copyright notice and this permission notice shall be included in 19 | // all copies or substantial portions of the Software. 20 | // 21 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 22 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 23 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 24 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 25 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 26 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 27 | // IN THE SOFTWARE. 28 | // 29 | 30 | #import 31 | 32 | #pragma mark ALAttributes 33 | 34 | typedef NS_ENUM(NSInteger, ALEdge) { 35 | ALEdgeLeft = NSLayoutAttributeLeft, // the left edge of the view 36 | ALEdgeRight = NSLayoutAttributeRight, // the right edge of the view 37 | ALEdgeTop = NSLayoutAttributeTop, // the top edge of the view 38 | ALEdgeBottom = NSLayoutAttributeBottom, // the bottom edge of the view 39 | ALEdgeLeading = NSLayoutAttributeLeading, // the leading edge of the view (left edge for left-to-right languages like English, right edge for right-to-left languages like Arabic) 40 | ALEdgeTrailing = NSLayoutAttributeTrailing // the trailing edge of the view (right edge for left-to-right languages like English, left edge for right-to-left languages like Arabic) 41 | }; 42 | 43 | typedef NS_ENUM(NSInteger, ALDimension) { 44 | ALDimensionWidth = NSLayoutAttributeWidth, // the width of the view 45 | ALDimensionHeight = NSLayoutAttributeHeight // the height of the view 46 | }; 47 | 48 | typedef NS_ENUM(NSInteger, ALAxis) { 49 | ALAxisVertical = NSLayoutAttributeCenterX, // a vertical line through the center of the view 50 | ALAxisHorizontal = NSLayoutAttributeCenterY, // a horizontal line through the center of the view 51 | ALAxisBaseline = NSLayoutAttributeBaseline // a horizontal line at the text baseline (not applicable to all views) 52 | }; 53 | 54 | typedef void(^ALConstraintsBlock)(void); // a block of method calls to the UIView+AutoLayout category API 55 | 56 | 57 | #pragma mark - UIView+AutoLayout 58 | 59 | /** 60 | A category on UIView that provides a simple yet powerful interface for creating Auto Layout constraints. 61 | */ 62 | @interface UIView (AutoLayout) 63 | 64 | 65 | #pragma mark Factory & Initializer Methods 66 | 67 | /** Creates and returns a new view that does not convert the autoresizing mask into constraints. */ 68 | + (instancetype)newAutoLayoutView; 69 | 70 | /** Initializes and returns a new view that does not convert the autoresizing mask into constraints. */ 71 | - (instancetype)initForAutoLayout; 72 | 73 | 74 | #pragma mark Set Constraint Priority 75 | 76 | /** Sets the constraint priority to the given value for all constraints created using the UIView+AutoLayout category API within the given constraints block. 77 | NOTE: This method will have no effect (and will NOT set the priority) on constraints created or added using the SDK directly within the block! */ 78 | + (void)autoSetPriority:(UILayoutPriority)priority forConstraints:(ALConstraintsBlock)block; 79 | 80 | 81 | #pragma mark Remove Constraints 82 | 83 | /** Removes the given constraint from the view it has been added to. */ 84 | + (void)autoRemoveConstraint:(NSLayoutConstraint *)constraint; 85 | 86 | /** Removes the given constraints from the views they have been added to. */ 87 | + (void)autoRemoveConstraints:(NSArray *)constraints; 88 | 89 | /** Removes all explicit constraints that affect the view. 90 | WARNING: Apple's constraint solver is not optimized for large-scale constraint removal; you may encounter major performance issues after using this method. 91 | NOTE: This method preserves implicit constraints, such as intrinsic content size constraints, which you usually do not want to remove. */ 92 | - (void)autoRemoveConstraintsAffectingView; 93 | 94 | /** Removes all constraints that affect the view, optionally including implicit constraints. 95 | WARNING: Apple's constraint solver is not optimized for large-scale constraint removal; you may encounter major performance issues after using this method. 96 | NOTE: Implicit constraints are auto-generated lower priority constraints, and you usually do not want to remove these. */ 97 | - (void)autoRemoveConstraintsAffectingViewIncludingImplicitConstraints:(BOOL)shouldRemoveImplicitConstraints; 98 | 99 | /** Recursively removes all explicit constraints that affect the view and its subviews. 100 | WARNING: Apple's constraint solver is not optimized for large-scale constraint removal; you may encounter major performance issues after using this method. 101 | NOTE: This method preserves implicit constraints, such as intrinsic content size constraints, which you usually do not want to remove. */ 102 | - (void)autoRemoveConstraintsAffectingViewAndSubviews; 103 | 104 | /** Recursively removes all constraints from the view and its subviews, optionally including implicit constraints. 105 | WARNING: Apple's constraint solver is not optimized for large-scale constraint removal; you may encounter major performance issues after using this method. 106 | NOTE: Implicit constraints are auto-generated lower priority constraints, and you usually do not want to remove these. */ 107 | - (void)autoRemoveConstraintsAffectingViewAndSubviewsIncludingImplicitConstraints:(BOOL)shouldRemoveImplicitConstraints; 108 | 109 | 110 | #pragma mark Center in Superview 111 | 112 | /** Centers the view in its superview. */ 113 | - (NSArray *)autoCenterInSuperview; 114 | 115 | /** Aligns the view to the same axis of its superview. */ 116 | - (NSLayoutConstraint *)autoAlignAxisToSuperviewAxis:(ALAxis)axis; 117 | 118 | 119 | #pragma mark Pin Edges to Superview 120 | 121 | /** Pins the given edge of the view to the same edge of the superview with an inset. */ 122 | - (NSLayoutConstraint *)autoPinEdgeToSuperviewEdge:(ALEdge)edge withInset:(CGFloat)inset; 123 | 124 | /** Pins the given edge of the view to the same edge of the superview with an inset as a maximum or minimum. */ 125 | - (NSLayoutConstraint *)autoPinEdgeToSuperviewEdge:(ALEdge)edge withInset:(CGFloat)inset relation:(NSLayoutRelation)relation; 126 | 127 | /** Pins the edges of the view to the edges of its superview with the given edge insets. */ 128 | - (NSArray *)autoPinEdgesToSuperviewEdgesWithInsets:(UIEdgeInsets)insets; 129 | 130 | /** Pins 3 of the 4 edges of the view to the edges of its superview with the given edge insets, excluding one edge. */ 131 | - (NSArray *)autoPinEdgesToSuperviewEdgesWithInsets:(UIEdgeInsets)insets excludingEdge:(ALEdge)edge; 132 | 133 | 134 | #pragma mark Pin Edges 135 | 136 | /** Pins an edge of the view to a given edge of another view. */ 137 | - (NSLayoutConstraint *)autoPinEdge:(ALEdge)edge toEdge:(ALEdge)toEdge ofView:(UIView *)peerView; 138 | 139 | /** Pins an edge of the view to a given edge of another view with an offset. */ 140 | - (NSLayoutConstraint *)autoPinEdge:(ALEdge)edge toEdge:(ALEdge)toEdge ofView:(UIView *)peerView withOffset:(CGFloat)offset; 141 | 142 | /** Pins an edge of the view to a given edge of another view with an offset as a maximum or minimum. */ 143 | - (NSLayoutConstraint *)autoPinEdge:(ALEdge)edge toEdge:(ALEdge)toEdge ofView:(UIView *)peerView withOffset:(CGFloat)offset relation:(NSLayoutRelation)relation; 144 | 145 | 146 | #pragma mark Align Axes 147 | 148 | /** Aligns an axis of the view to the same axis of another view. */ 149 | - (NSLayoutConstraint *)autoAlignAxis:(ALAxis)axis toSameAxisOfView:(UIView *)peerView; 150 | 151 | /** Aligns an axis of the view to the same axis of another view with an offset. */ 152 | - (NSLayoutConstraint *)autoAlignAxis:(ALAxis)axis toSameAxisOfView:(UIView *)peerView withOffset:(CGFloat)offset; 153 | 154 | 155 | #pragma mark Match Dimensions 156 | 157 | /** Matches a dimension of the view to a given dimension of another view. */ 158 | - (NSLayoutConstraint *)autoMatchDimension:(ALDimension)dimension toDimension:(ALDimension)toDimension ofView:(UIView *)peerView; 159 | 160 | /** Matches a dimension of the view to a given dimension of another view with an offset. */ 161 | - (NSLayoutConstraint *)autoMatchDimension:(ALDimension)dimension toDimension:(ALDimension)toDimension ofView:(UIView *)peerView withOffset:(CGFloat)offset; 162 | 163 | /** Matches a dimension of the view to a given dimension of another view with an offset as a maximum or minimum. */ 164 | - (NSLayoutConstraint *)autoMatchDimension:(ALDimension)dimension toDimension:(ALDimension)toDimension ofView:(UIView *)peerView withOffset:(CGFloat)offset relation:(NSLayoutRelation)relation; 165 | 166 | /** Matches a dimension of the view to a multiple of a given dimension of another view. */ 167 | - (NSLayoutConstraint *)autoMatchDimension:(ALDimension)dimension toDimension:(ALDimension)toDimension ofView:(UIView *)peerView withMultiplier:(CGFloat)multiplier; 168 | 169 | /** Matches a dimension of the view to a multiple of a given dimension of another view as a maximum or minimum. */ 170 | - (NSLayoutConstraint *)autoMatchDimension:(ALDimension)dimension toDimension:(ALDimension)toDimension ofView:(UIView *)peerView withMultiplier:(CGFloat)multiplier relation:(NSLayoutRelation)relation; 171 | 172 | 173 | #pragma mark Set Dimensions 174 | 175 | /** Sets the view to a specific size. */ 176 | - (NSArray *)autoSetDimensionsToSize:(CGSize)size; 177 | 178 | /** Sets the given dimension of the view to a specific size. */ 179 | - (NSLayoutConstraint *)autoSetDimension:(ALDimension)dimension toSize:(CGFloat)size; 180 | 181 | /** Sets the given dimension of the view to a specific size as a maximum or minimum. */ 182 | - (NSLayoutConstraint *)autoSetDimension:(ALDimension)dimension toSize:(CGFloat)size relation:(NSLayoutRelation)relation; 183 | 184 | 185 | #pragma mark Set Content Compression Resistance & Hugging 186 | 187 | /** Sets the priority of content compression resistance for an axis. 188 | NOTE: This method must only be called from within the block passed into the method +[UIView autoSetPriority:forConstraints:] */ 189 | - (void)autoSetContentCompressionResistancePriorityForAxis:(ALAxis)axis; 190 | 191 | /** Sets the priority of content hugging for an axis. 192 | NOTE: This method must only be called from within the block passed into the method +[UIView autoSetPriority:forConstraints:] */ 193 | - (void)autoSetContentHuggingPriorityForAxis:(ALAxis)axis; 194 | 195 | 196 | #pragma mark Constrain Any Attributes 197 | 198 | /** Constrains an attribute (any ALEdge, ALAxis, or ALDimension) of the view to a given attribute of another view. */ 199 | - (NSLayoutConstraint *)autoConstrainAttribute:(NSInteger)attribute toAttribute:(NSInteger)toAttribute ofView:(UIView *)peerView; 200 | 201 | /** Constrains an attribute (any ALEdge, ALAxis, or ALDimension) of the view to a given attribute of another view with an offset. */ 202 | - (NSLayoutConstraint *)autoConstrainAttribute:(NSInteger)attribute toAttribute:(NSInteger)toAttribute ofView:(UIView *)peerView withOffset:(CGFloat)offset; 203 | 204 | /** Constrains an attribute (any ALEdge, ALAxis, or ALDimension) of the view to a given attribute of another view with an offset as a maximum or minimum. */ 205 | - (NSLayoutConstraint *)autoConstrainAttribute:(NSInteger)attribute toAttribute:(NSInteger)toAttribute ofView:(UIView *)peerView withOffset:(CGFloat)offset relation:(NSLayoutRelation)relation; 206 | 207 | /** Constrains an attribute (any ALEdge, ALAxis, or ALDimension) of the view to a given attribute of another view with a multiplier. */ 208 | - (NSLayoutConstraint *)autoConstrainAttribute:(NSInteger)attribute toAttribute:(NSInteger)toAttribute ofView:(UIView *)peerView withMultiplier:(CGFloat)multiplier; 209 | 210 | /** Constrains an attribute (any ALEdge, ALAxis, or ALDimension) of the view to a given attribute of another view with a multiplier as a maximum or minimum. */ 211 | - (NSLayoutConstraint *)autoConstrainAttribute:(NSInteger)attribute toAttribute:(NSInteger)toAttribute ofView:(UIView *)peerView withMultiplier:(CGFloat)multiplier relation:(NSLayoutRelation)relation; 212 | 213 | 214 | #pragma mark Pin to Layout Guides 215 | 216 | /** Pins the top edge of the view to the top layout guide of the given view controller with an inset. */ 217 | - (NSLayoutConstraint *)autoPinToTopLayoutGuideOfViewController:(UIViewController *)viewController withInset:(CGFloat)inset; 218 | 219 | /** Pins the bottom edge of the view to the bottom layout guide of the given view controller with an inset. */ 220 | - (NSLayoutConstraint *)autoPinToBottomLayoutGuideOfViewController:(UIViewController *)viewController withInset:(CGFloat)inset; 221 | 222 | @end 223 | 224 | 225 | #pragma mark - NSArray+AutoLayout 226 | 227 | /** 228 | A category on NSArray that provides a simple yet powerful interface for applying constraints to groups of views. 229 | */ 230 | @interface NSArray (AutoLayout) 231 | 232 | 233 | #pragma mark Constrain Multiple Views 234 | 235 | /** Aligns views in this array to one another along a given edge. */ 236 | - (NSArray *)autoAlignViewsToEdge:(ALEdge)edge; 237 | 238 | /** Aligns views in this array to one another along a given axis. */ 239 | - (NSArray *)autoAlignViewsToAxis:(ALAxis)axis; 240 | 241 | /** Matches a given dimension of all the views in this array. */ 242 | - (NSArray *)autoMatchViewsDimension:(ALDimension)dimension; 243 | 244 | /** Sets the given dimension of all the views in this array to a given size. */ 245 | - (NSArray *)autoSetViewsDimension:(ALDimension)dimension toSize:(CGFloat)size; 246 | 247 | 248 | #pragma mark Distribute Multiple Views 249 | 250 | /** Distributes the views in this array equally along the selected axis in their superview. Views will be the same size (variable) in the dimension along the axis and will have spacing (fixed) between them. */ 251 | - (NSArray *)autoDistributeViewsAlongAxis:(ALAxis)axis withFixedSpacing:(CGFloat)spacing alignment:(NSLayoutFormatOptions)alignment; 252 | 253 | /** Distributes the views in this array equally along the selected axis in their superview. Views will be the same size (variable) in the dimension along the axis and will have spacing (fixed) between them, with optional insets from the first and last views to their superview. */ 254 | - (NSArray *)autoDistributeViewsAlongAxis:(ALAxis)axis withFixedSpacing:(CGFloat)spacing insetSpacing:(BOOL)shouldSpaceInsets alignment:(NSLayoutFormatOptions)alignment; 255 | 256 | /** Distributes the views in this array equally along the selected axis in their superview. Views will be the same size (fixed) in the dimension along the axis and will have spacing (variable) between them. */ 257 | - (NSArray *)autoDistributeViewsAlongAxis:(ALAxis)axis withFixedSize:(CGFloat)size alignment:(NSLayoutFormatOptions)alignment; 258 | 259 | /** Distributes the views in this array equally along the selected axis in their superview. Views will be the same size (fixed) in the dimension along the axis and will have spacing (variable) between them, with optional insets from the first and last views to their superview. */ 260 | - (NSArray *)autoDistributeViewsAlongAxis:(ALAxis)axis withFixedSize:(CGFloat)size insetSpacing:(BOOL)shouldSpaceInsets alignment:(NSLayoutFormatOptions)alignment; 261 | 262 | @end 263 | 264 | 265 | #pragma mark - NSLayoutConstraint+AutoLayout 266 | 267 | /** 268 | A category on NSLayoutConstraint that allows constraints to be easily removed. 269 | */ 270 | @interface NSLayoutConstraint (AutoLayout) 271 | 272 | /** Adds the constraint to the appropriate view. */ 273 | - (void)autoInstall; 274 | 275 | /** Removes the constraint from the view it has been added to. */ 276 | - (void)autoRemove; 277 | 278 | @end 279 | -------------------------------------------------------------------------------- /DSAlert-OC/DSAlertFrameWork.framework/Headers/UIView+AutoLayout.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIView+AutoLayout.h 3 | // v2.0.0 4 | // https://github.com/smileyborg/UIView-AutoLayout 5 | // 6 | // Copyright (c) 2012 Richard Turton 7 | // Copyright (c) 2013 Tyler Fox 8 | // 9 | // This code is distributed under the terms and conditions of the MIT license. 10 | // 11 | // Permission is hereby granted, free of charge, to any person obtaining a copy 12 | // of this software and associated documentation files (the "Software"), to 13 | // deal in the Software without restriction, including without limitation the 14 | // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 15 | // sell copies of the Software, and to permit persons to whom the Software is 16 | // furnished to do so, subject to the following conditions: 17 | // 18 | // The above copyright notice and this permission notice shall be included in 19 | // all copies or substantial portions of the Software. 20 | // 21 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 22 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 23 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 24 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 25 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 26 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 27 | // IN THE SOFTWARE. 28 | // 29 | 30 | #import 31 | 32 | #pragma mark ALAttributes 33 | 34 | typedef NS_ENUM(NSInteger, ALEdge) { 35 | ALEdgeLeft = NSLayoutAttributeLeft, // the left edge of the view 36 | ALEdgeRight = NSLayoutAttributeRight, // the right edge of the view 37 | ALEdgeTop = NSLayoutAttributeTop, // the top edge of the view 38 | ALEdgeBottom = NSLayoutAttributeBottom, // the bottom edge of the view 39 | ALEdgeLeading = NSLayoutAttributeLeading, // the leading edge of the view (left edge for left-to-right languages like English, right edge for right-to-left languages like Arabic) 40 | ALEdgeTrailing = NSLayoutAttributeTrailing // the trailing edge of the view (right edge for left-to-right languages like English, left edge for right-to-left languages like Arabic) 41 | }; 42 | 43 | typedef NS_ENUM(NSInteger, ALDimension) { 44 | ALDimensionWidth = NSLayoutAttributeWidth, // the width of the view 45 | ALDimensionHeight = NSLayoutAttributeHeight // the height of the view 46 | }; 47 | 48 | typedef NS_ENUM(NSInteger, ALAxis) { 49 | ALAxisVertical = NSLayoutAttributeCenterX, // a vertical line through the center of the view 50 | ALAxisHorizontal = NSLayoutAttributeCenterY, // a horizontal line through the center of the view 51 | ALAxisBaseline = NSLayoutAttributeBaseline // a horizontal line at the text baseline (not applicable to all views) 52 | }; 53 | 54 | typedef void(^ALConstraintsBlock)(void); // a block of method calls to the UIView+AutoLayout category API 55 | 56 | 57 | #pragma mark - UIView+AutoLayout 58 | 59 | /** 60 | A category on UIView that provides a simple yet powerful interface for creating Auto Layout constraints. 61 | */ 62 | @interface UIView (AutoLayout) 63 | 64 | 65 | #pragma mark Factory & Initializer Methods 66 | 67 | /** Creates and returns a new view that does not convert the autoresizing mask into constraints. */ 68 | + (instancetype)newAutoLayoutView; 69 | 70 | /** Initializes and returns a new view that does not convert the autoresizing mask into constraints. */ 71 | - (instancetype)initForAutoLayout; 72 | 73 | 74 | #pragma mark Set Constraint Priority 75 | 76 | /** Sets the constraint priority to the given value for all constraints created using the UIView+AutoLayout category API within the given constraints block. 77 | NOTE: This method will have no effect (and will NOT set the priority) on constraints created or added using the SDK directly within the block! */ 78 | + (void)autoSetPriority:(UILayoutPriority)priority forConstraints:(ALConstraintsBlock)block; 79 | 80 | 81 | #pragma mark Remove Constraints 82 | 83 | /** Removes the given constraint from the view it has been added to. */ 84 | + (void)autoRemoveConstraint:(NSLayoutConstraint *)constraint; 85 | 86 | /** Removes the given constraints from the views they have been added to. */ 87 | + (void)autoRemoveConstraints:(NSArray *)constraints; 88 | 89 | /** Removes all explicit constraints that affect the view. 90 | WARNING: Apple's constraint solver is not optimized for large-scale constraint removal; you may encounter major performance issues after using this method. 91 | NOTE: This method preserves implicit constraints, such as intrinsic content size constraints, which you usually do not want to remove. */ 92 | - (void)autoRemoveConstraintsAffectingView; 93 | 94 | /** Removes all constraints that affect the view, optionally including implicit constraints. 95 | WARNING: Apple's constraint solver is not optimized for large-scale constraint removal; you may encounter major performance issues after using this method. 96 | NOTE: Implicit constraints are auto-generated lower priority constraints, and you usually do not want to remove these. */ 97 | - (void)autoRemoveConstraintsAffectingViewIncludingImplicitConstraints:(BOOL)shouldRemoveImplicitConstraints; 98 | 99 | /** Recursively removes all explicit constraints that affect the view and its subviews. 100 | WARNING: Apple's constraint solver is not optimized for large-scale constraint removal; you may encounter major performance issues after using this method. 101 | NOTE: This method preserves implicit constraints, such as intrinsic content size constraints, which you usually do not want to remove. */ 102 | - (void)autoRemoveConstraintsAffectingViewAndSubviews; 103 | 104 | /** Recursively removes all constraints from the view and its subviews, optionally including implicit constraints. 105 | WARNING: Apple's constraint solver is not optimized for large-scale constraint removal; you may encounter major performance issues after using this method. 106 | NOTE: Implicit constraints are auto-generated lower priority constraints, and you usually do not want to remove these. */ 107 | - (void)autoRemoveConstraintsAffectingViewAndSubviewsIncludingImplicitConstraints:(BOOL)shouldRemoveImplicitConstraints; 108 | 109 | 110 | #pragma mark Center in Superview 111 | 112 | /** Centers the view in its superview. */ 113 | - (NSArray *)autoCenterInSuperview; 114 | 115 | /** Aligns the view to the same axis of its superview. */ 116 | - (NSLayoutConstraint *)autoAlignAxisToSuperviewAxis:(ALAxis)axis; 117 | 118 | 119 | #pragma mark Pin Edges to Superview 120 | 121 | /** Pins the given edge of the view to the same edge of the superview with an inset. */ 122 | - (NSLayoutConstraint *)autoPinEdgeToSuperviewEdge:(ALEdge)edge withInset:(CGFloat)inset; 123 | 124 | /** Pins the given edge of the view to the same edge of the superview with an inset as a maximum or minimum. */ 125 | - (NSLayoutConstraint *)autoPinEdgeToSuperviewEdge:(ALEdge)edge withInset:(CGFloat)inset relation:(NSLayoutRelation)relation; 126 | 127 | /** Pins the edges of the view to the edges of its superview with the given edge insets. */ 128 | - (NSArray *)autoPinEdgesToSuperviewEdgesWithInsets:(UIEdgeInsets)insets; 129 | 130 | /** Pins 3 of the 4 edges of the view to the edges of its superview with the given edge insets, excluding one edge. */ 131 | - (NSArray *)autoPinEdgesToSuperviewEdgesWithInsets:(UIEdgeInsets)insets excludingEdge:(ALEdge)edge; 132 | 133 | 134 | #pragma mark Pin Edges 135 | 136 | /** Pins an edge of the view to a given edge of another view. */ 137 | - (NSLayoutConstraint *)autoPinEdge:(ALEdge)edge toEdge:(ALEdge)toEdge ofView:(UIView *)peerView; 138 | 139 | /** Pins an edge of the view to a given edge of another view with an offset. */ 140 | - (NSLayoutConstraint *)autoPinEdge:(ALEdge)edge toEdge:(ALEdge)toEdge ofView:(UIView *)peerView withOffset:(CGFloat)offset; 141 | 142 | /** Pins an edge of the view to a given edge of another view with an offset as a maximum or minimum. */ 143 | - (NSLayoutConstraint *)autoPinEdge:(ALEdge)edge toEdge:(ALEdge)toEdge ofView:(UIView *)peerView withOffset:(CGFloat)offset relation:(NSLayoutRelation)relation; 144 | 145 | 146 | #pragma mark Align Axes 147 | 148 | /** Aligns an axis of the view to the same axis of another view. */ 149 | - (NSLayoutConstraint *)autoAlignAxis:(ALAxis)axis toSameAxisOfView:(UIView *)peerView; 150 | 151 | /** Aligns an axis of the view to the same axis of another view with an offset. */ 152 | - (NSLayoutConstraint *)autoAlignAxis:(ALAxis)axis toSameAxisOfView:(UIView *)peerView withOffset:(CGFloat)offset; 153 | 154 | 155 | #pragma mark Match Dimensions 156 | 157 | /** Matches a dimension of the view to a given dimension of another view. */ 158 | - (NSLayoutConstraint *)autoMatchDimension:(ALDimension)dimension toDimension:(ALDimension)toDimension ofView:(UIView *)peerView; 159 | 160 | /** Matches a dimension of the view to a given dimension of another view with an offset. */ 161 | - (NSLayoutConstraint *)autoMatchDimension:(ALDimension)dimension toDimension:(ALDimension)toDimension ofView:(UIView *)peerView withOffset:(CGFloat)offset; 162 | 163 | /** Matches a dimension of the view to a given dimension of another view with an offset as a maximum or minimum. */ 164 | - (NSLayoutConstraint *)autoMatchDimension:(ALDimension)dimension toDimension:(ALDimension)toDimension ofView:(UIView *)peerView withOffset:(CGFloat)offset relation:(NSLayoutRelation)relation; 165 | 166 | /** Matches a dimension of the view to a multiple of a given dimension of another view. */ 167 | - (NSLayoutConstraint *)autoMatchDimension:(ALDimension)dimension toDimension:(ALDimension)toDimension ofView:(UIView *)peerView withMultiplier:(CGFloat)multiplier; 168 | 169 | /** Matches a dimension of the view to a multiple of a given dimension of another view as a maximum or minimum. */ 170 | - (NSLayoutConstraint *)autoMatchDimension:(ALDimension)dimension toDimension:(ALDimension)toDimension ofView:(UIView *)peerView withMultiplier:(CGFloat)multiplier relation:(NSLayoutRelation)relation; 171 | 172 | 173 | #pragma mark Set Dimensions 174 | 175 | /** Sets the view to a specific size. */ 176 | - (NSArray *)autoSetDimensionsToSize:(CGSize)size; 177 | 178 | /** Sets the given dimension of the view to a specific size. */ 179 | - (NSLayoutConstraint *)autoSetDimension:(ALDimension)dimension toSize:(CGFloat)size; 180 | 181 | /** Sets the given dimension of the view to a specific size as a maximum or minimum. */ 182 | - (NSLayoutConstraint *)autoSetDimension:(ALDimension)dimension toSize:(CGFloat)size relation:(NSLayoutRelation)relation; 183 | 184 | 185 | #pragma mark Set Content Compression Resistance & Hugging 186 | 187 | /** Sets the priority of content compression resistance for an axis. 188 | NOTE: This method must only be called from within the block passed into the method +[UIView autoSetPriority:forConstraints:] */ 189 | - (void)autoSetContentCompressionResistancePriorityForAxis:(ALAxis)axis; 190 | 191 | /** Sets the priority of content hugging for an axis. 192 | NOTE: This method must only be called from within the block passed into the method +[UIView autoSetPriority:forConstraints:] */ 193 | - (void)autoSetContentHuggingPriorityForAxis:(ALAxis)axis; 194 | 195 | 196 | #pragma mark Constrain Any Attributes 197 | 198 | /** Constrains an attribute (any ALEdge, ALAxis, or ALDimension) of the view to a given attribute of another view. */ 199 | - (NSLayoutConstraint *)autoConstrainAttribute:(NSInteger)attribute toAttribute:(NSInteger)toAttribute ofView:(UIView *)peerView; 200 | 201 | /** Constrains an attribute (any ALEdge, ALAxis, or ALDimension) of the view to a given attribute of another view with an offset. */ 202 | - (NSLayoutConstraint *)autoConstrainAttribute:(NSInteger)attribute toAttribute:(NSInteger)toAttribute ofView:(UIView *)peerView withOffset:(CGFloat)offset; 203 | 204 | /** Constrains an attribute (any ALEdge, ALAxis, or ALDimension) of the view to a given attribute of another view with an offset as a maximum or minimum. */ 205 | - (NSLayoutConstraint *)autoConstrainAttribute:(NSInteger)attribute toAttribute:(NSInteger)toAttribute ofView:(UIView *)peerView withOffset:(CGFloat)offset relation:(NSLayoutRelation)relation; 206 | 207 | /** Constrains an attribute (any ALEdge, ALAxis, or ALDimension) of the view to a given attribute of another view with a multiplier. */ 208 | - (NSLayoutConstraint *)autoConstrainAttribute:(NSInteger)attribute toAttribute:(NSInteger)toAttribute ofView:(UIView *)peerView withMultiplier:(CGFloat)multiplier; 209 | 210 | /** Constrains an attribute (any ALEdge, ALAxis, or ALDimension) of the view to a given attribute of another view with a multiplier as a maximum or minimum. */ 211 | - (NSLayoutConstraint *)autoConstrainAttribute:(NSInteger)attribute toAttribute:(NSInteger)toAttribute ofView:(UIView *)peerView withMultiplier:(CGFloat)multiplier relation:(NSLayoutRelation)relation; 212 | 213 | 214 | #pragma mark Pin to Layout Guides 215 | 216 | /** Pins the top edge of the view to the top layout guide of the given view controller with an inset. */ 217 | - (NSLayoutConstraint *)autoPinToTopLayoutGuideOfViewController:(UIViewController *)viewController withInset:(CGFloat)inset; 218 | 219 | /** Pins the bottom edge of the view to the bottom layout guide of the given view controller with an inset. */ 220 | - (NSLayoutConstraint *)autoPinToBottomLayoutGuideOfViewController:(UIViewController *)viewController withInset:(CGFloat)inset; 221 | 222 | @end 223 | 224 | 225 | #pragma mark - NSArray+AutoLayout 226 | 227 | /** 228 | A category on NSArray that provides a simple yet powerful interface for applying constraints to groups of views. 229 | */ 230 | @interface NSArray (AutoLayout) 231 | 232 | 233 | #pragma mark Constrain Multiple Views 234 | 235 | /** Aligns views in this array to one another along a given edge. */ 236 | - (NSArray *)autoAlignViewsToEdge:(ALEdge)edge; 237 | 238 | /** Aligns views in this array to one another along a given axis. */ 239 | - (NSArray *)autoAlignViewsToAxis:(ALAxis)axis; 240 | 241 | /** Matches a given dimension of all the views in this array. */ 242 | - (NSArray *)autoMatchViewsDimension:(ALDimension)dimension; 243 | 244 | /** Sets the given dimension of all the views in this array to a given size. */ 245 | - (NSArray *)autoSetViewsDimension:(ALDimension)dimension toSize:(CGFloat)size; 246 | 247 | 248 | #pragma mark Distribute Multiple Views 249 | 250 | /** Distributes the views in this array equally along the selected axis in their superview. Views will be the same size (variable) in the dimension along the axis and will have spacing (fixed) between them. */ 251 | - (NSArray *)autoDistributeViewsAlongAxis:(ALAxis)axis withFixedSpacing:(CGFloat)spacing alignment:(NSLayoutFormatOptions)alignment; 252 | 253 | /** Distributes the views in this array equally along the selected axis in their superview. Views will be the same size (variable) in the dimension along the axis and will have spacing (fixed) between them, with optional insets from the first and last views to their superview. */ 254 | - (NSArray *)autoDistributeViewsAlongAxis:(ALAxis)axis withFixedSpacing:(CGFloat)spacing insetSpacing:(BOOL)shouldSpaceInsets alignment:(NSLayoutFormatOptions)alignment; 255 | 256 | /** Distributes the views in this array equally along the selected axis in their superview. Views will be the same size (fixed) in the dimension along the axis and will have spacing (variable) between them. */ 257 | - (NSArray *)autoDistributeViewsAlongAxis:(ALAxis)axis withFixedSize:(CGFloat)size alignment:(NSLayoutFormatOptions)alignment; 258 | 259 | /** Distributes the views in this array equally along the selected axis in their superview. Views will be the same size (fixed) in the dimension along the axis and will have spacing (variable) between them, with optional insets from the first and last views to their superview. */ 260 | - (NSArray *)autoDistributeViewsAlongAxis:(ALAxis)axis withFixedSize:(CGFloat)size insetSpacing:(BOOL)shouldSpaceInsets alignment:(NSLayoutFormatOptions)alignment; 261 | 262 | @end 263 | 264 | 265 | #pragma mark - NSLayoutConstraint+AutoLayout 266 | 267 | /** 268 | A category on NSLayoutConstraint that allows constraints to be easily removed. 269 | */ 270 | @interface NSLayoutConstraint (AutoLayout) 271 | 272 | /** Adds the constraint to the appropriate view. */ 273 | - (void)autoInstall; 274 | 275 | /** Removes the constraint from the view it has been added to. */ 276 | - (void)autoRemove; 277 | 278 | @end 279 | -------------------------------------------------------------------------------- /DSAlert-OC.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 613B1C9E1D81592900625FFF /* Alert6.m in Sources */ = {isa = PBXBuildFile; fileRef = 613B1C9D1D81592900625FFF /* Alert6.m */; }; 11 | 613B1CA01D81593300625FFF /* Alert6.xib in Resources */ = {isa = PBXBuildFile; fileRef = 613B1C9F1D81593300625FFF /* Alert6.xib */; }; 12 | 61EBC03E1D82502000CF55C3 /* DSAlertFrameWork.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 61EBC03D1D82502000CF55C3 /* DSAlertFrameWork.framework */; }; 13 | C474C7641D82A55D00D5637F /* VerCodeAlertView.m in Sources */ = {isa = PBXBuildFile; fileRef = C474C7621D82A55D00D5637F /* VerCodeAlertView.m */; }; 14 | C474C7651D82A55D00D5637F /* VerCodeAlertView.xib in Resources */ = {isa = PBXBuildFile; fileRef = C474C7631D82A55D00D5637F /* VerCodeAlertView.xib */; }; 15 | C4EA7C231D7AD19D00D790CA /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = C4EA7C221D7AD19D00D790CA /* main.m */; }; 16 | C4EA7C261D7AD19D00D790CA /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = C4EA7C251D7AD19D00D790CA /* AppDelegate.m */; }; 17 | C4EA7C291D7AD19D00D790CA /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = C4EA7C281D7AD19D00D790CA /* ViewController.m */; }; 18 | C4EA7C2E1D7AD19D00D790CA /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = C4EA7C2D1D7AD19D00D790CA /* Assets.xcassets */; }; 19 | C4EA7C311D7AD19D00D790CA /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = C4EA7C2F1D7AD19D00D790CA /* LaunchScreen.storyboard */; }; 20 | C4EA7C4B1D7AD1EE00D790CA /* ViewController2.m in Sources */ = {isa = PBXBuildFile; fileRef = C4EA7C491D7AD1EE00D790CA /* ViewController2.m */; }; 21 | C4EA7C4C1D7AD1EE00D790CA /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = C4EA7C4A1D7AD1EE00D790CA /* Main.storyboard */; }; 22 | C4EA7C501D7AD26100D790CA /* 123.png in Resources */ = {isa = PBXBuildFile; fileRef = C4EA7C4D1D7AD26000D790CA /* 123.png */; }; 23 | C4EA7C511D7AD26100D790CA /* 背景.jpg in Resources */ = {isa = PBXBuildFile; fileRef = C4EA7C4E1D7AD26100D790CA /* 背景.jpg */; }; 24 | C4EA7C521D7AD26100D790CA /* 美女.jpg in Resources */ = {isa = PBXBuildFile; fileRef = C4EA7C4F1D7AD26100D790CA /* 美女.jpg */; }; 25 | C4EEBCF41DF1159A0061F6D7 /* CALayer+Animation.m in Sources */ = {isa = PBXBuildFile; fileRef = C4EEBCEA1DF1159A0061F6D7 /* CALayer+Animation.m */; }; 26 | C4EEBCF51DF1159A0061F6D7 /* DSActionSheet.m in Sources */ = {isa = PBXBuildFile; fileRef = C4EEBCEC1DF1159A0061F6D7 /* DSActionSheet.m */; }; 27 | C4EEBCF61DF1159A0061F6D7 /* DSAlert.m in Sources */ = {isa = PBXBuildFile; fileRef = C4EEBCEE1DF1159A0061F6D7 /* DSAlert.m */; }; 28 | C4EEBCF71DF1159A0061F6D7 /* DSTableCell.m in Sources */ = {isa = PBXBuildFile; fileRef = C4EEBCF01DF1159A0061F6D7 /* DSTableCell.m */; }; 29 | C4EEBCF81DF1159A0061F6D7 /* DSTableCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = C4EEBCF11DF1159A0061F6D7 /* DSTableCell.xib */; }; 30 | C4EEBCF91DF1159A0061F6D7 /* UIView+AutoLayout.m in Sources */ = {isa = PBXBuildFile; fileRef = C4EEBCF31DF1159A0061F6D7 /* UIView+AutoLayout.m */; }; 31 | /* End PBXBuildFile section */ 32 | 33 | /* Begin PBXFileReference section */ 34 | 613B1C9C1D81592900625FFF /* Alert6.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Alert6.h; sourceTree = ""; }; 35 | 613B1C9D1D81592900625FFF /* Alert6.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Alert6.m; sourceTree = ""; }; 36 | 613B1C9F1D81593300625FFF /* Alert6.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = Alert6.xib; sourceTree = ""; }; 37 | 61EBC03D1D82502000CF55C3 /* DSAlertFrameWork.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = DSAlertFrameWork.framework; sourceTree = ""; }; 38 | C474C7611D82A55D00D5637F /* VerCodeAlertView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VerCodeAlertView.h; sourceTree = ""; }; 39 | C474C7621D82A55D00D5637F /* VerCodeAlertView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = VerCodeAlertView.m; sourceTree = ""; }; 40 | C474C7631D82A55D00D5637F /* VerCodeAlertView.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = VerCodeAlertView.xib; sourceTree = ""; }; 41 | C4EA7C1E1D7AD19D00D790CA /* DSAlert-OC.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "DSAlert-OC.app"; sourceTree = BUILT_PRODUCTS_DIR; }; 42 | C4EA7C221D7AD19D00D790CA /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 43 | C4EA7C241D7AD19D00D790CA /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 44 | C4EA7C251D7AD19D00D790CA /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 45 | C4EA7C271D7AD19D00D790CA /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; 46 | C4EA7C281D7AD19D00D790CA /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; 47 | C4EA7C2D1D7AD19D00D790CA /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 48 | C4EA7C301D7AD19D00D790CA /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 49 | C4EA7C321D7AD19D00D790CA /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 50 | C4EA7C481D7AD1EE00D790CA /* ViewController2.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ViewController2.h; sourceTree = ""; }; 51 | C4EA7C491D7AD1EE00D790CA /* ViewController2.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ViewController2.m; sourceTree = ""; }; 52 | C4EA7C4A1D7AD1EE00D790CA /* Main.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = Main.storyboard; sourceTree = ""; }; 53 | C4EA7C4D1D7AD26000D790CA /* 123.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = 123.png; sourceTree = ""; }; 54 | C4EA7C4E1D7AD26100D790CA /* 背景.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = "背景.jpg"; sourceTree = ""; }; 55 | C4EA7C4F1D7AD26100D790CA /* 美女.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = "美女.jpg"; sourceTree = ""; }; 56 | C4EEBCE91DF1159A0061F6D7 /* CALayer+Animation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "CALayer+Animation.h"; sourceTree = ""; }; 57 | C4EEBCEA1DF1159A0061F6D7 /* CALayer+Animation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "CALayer+Animation.m"; sourceTree = ""; }; 58 | C4EEBCEB1DF1159A0061F6D7 /* DSActionSheet.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DSActionSheet.h; sourceTree = ""; }; 59 | C4EEBCEC1DF1159A0061F6D7 /* DSActionSheet.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DSActionSheet.m; sourceTree = ""; }; 60 | C4EEBCED1DF1159A0061F6D7 /* DSAlert.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DSAlert.h; sourceTree = ""; }; 61 | C4EEBCEE1DF1159A0061F6D7 /* DSAlert.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DSAlert.m; sourceTree = ""; }; 62 | C4EEBCEF1DF1159A0061F6D7 /* DSTableCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DSTableCell.h; sourceTree = ""; }; 63 | C4EEBCF01DF1159A0061F6D7 /* DSTableCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DSTableCell.m; sourceTree = ""; }; 64 | C4EEBCF11DF1159A0061F6D7 /* DSTableCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = DSTableCell.xib; sourceTree = ""; }; 65 | C4EEBCF21DF1159A0061F6D7 /* UIView+AutoLayout.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIView+AutoLayout.h"; sourceTree = ""; }; 66 | C4EEBCF31DF1159A0061F6D7 /* UIView+AutoLayout.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIView+AutoLayout.m"; sourceTree = ""; }; 67 | /* End PBXFileReference section */ 68 | 69 | /* Begin PBXFrameworksBuildPhase section */ 70 | C4EA7C1B1D7AD19D00D790CA /* Frameworks */ = { 71 | isa = PBXFrameworksBuildPhase; 72 | buildActionMask = 2147483647; 73 | files = ( 74 | 61EBC03E1D82502000CF55C3 /* DSAlertFrameWork.framework in Frameworks */, 75 | ); 76 | runOnlyForDeploymentPostprocessing = 0; 77 | }; 78 | /* End PBXFrameworksBuildPhase section */ 79 | 80 | /* Begin PBXGroup section */ 81 | C4EA7C151D7AD19D00D790CA = { 82 | isa = PBXGroup; 83 | children = ( 84 | C4EA7C201D7AD19D00D790CA /* DSAlert-OC */, 85 | C4EA7C1F1D7AD19D00D790CA /* Products */, 86 | ); 87 | sourceTree = ""; 88 | }; 89 | C4EA7C1F1D7AD19D00D790CA /* Products */ = { 90 | isa = PBXGroup; 91 | children = ( 92 | C4EA7C1E1D7AD19D00D790CA /* DSAlert-OC.app */, 93 | ); 94 | name = Products; 95 | sourceTree = ""; 96 | }; 97 | C4EA7C201D7AD19D00D790CA /* DSAlert-OC */ = { 98 | isa = PBXGroup; 99 | children = ( 100 | 61EBC03D1D82502000CF55C3 /* DSAlertFrameWork.framework */, 101 | C4EEBCE81DF1159A0061F6D7 /* DSAlert */, 102 | C4EA7C241D7AD19D00D790CA /* AppDelegate.h */, 103 | C4EA7C251D7AD19D00D790CA /* AppDelegate.m */, 104 | C4EA7C271D7AD19D00D790CA /* ViewController.h */, 105 | C4EA7C281D7AD19D00D790CA /* ViewController.m */, 106 | C4EA7C481D7AD1EE00D790CA /* ViewController2.h */, 107 | C4EA7C491D7AD1EE00D790CA /* ViewController2.m */, 108 | C474C7611D82A55D00D5637F /* VerCodeAlertView.h */, 109 | C474C7621D82A55D00D5637F /* VerCodeAlertView.m */, 110 | C474C7631D82A55D00D5637F /* VerCodeAlertView.xib */, 111 | 613B1C9C1D81592900625FFF /* Alert6.h */, 112 | 613B1C9D1D81592900625FFF /* Alert6.m */, 113 | 613B1C9F1D81593300625FFF /* Alert6.xib */, 114 | C4EA7C4D1D7AD26000D790CA /* 123.png */, 115 | C4EA7C4E1D7AD26100D790CA /* 背景.jpg */, 116 | C4EA7C4F1D7AD26100D790CA /* 美女.jpg */, 117 | C4EA7C4A1D7AD1EE00D790CA /* Main.storyboard */, 118 | C4EA7C2D1D7AD19D00D790CA /* Assets.xcassets */, 119 | C4EA7C2F1D7AD19D00D790CA /* LaunchScreen.storyboard */, 120 | C4EA7C321D7AD19D00D790CA /* Info.plist */, 121 | C4EA7C211D7AD19D00D790CA /* Supporting Files */, 122 | ); 123 | path = "DSAlert-OC"; 124 | sourceTree = ""; 125 | }; 126 | C4EA7C211D7AD19D00D790CA /* Supporting Files */ = { 127 | isa = PBXGroup; 128 | children = ( 129 | C4EA7C221D7AD19D00D790CA /* main.m */, 130 | ); 131 | name = "Supporting Files"; 132 | sourceTree = ""; 133 | }; 134 | C4EEBCE81DF1159A0061F6D7 /* DSAlert */ = { 135 | isa = PBXGroup; 136 | children = ( 137 | C4EEBCE91DF1159A0061F6D7 /* CALayer+Animation.h */, 138 | C4EEBCEA1DF1159A0061F6D7 /* CALayer+Animation.m */, 139 | C4EEBCEB1DF1159A0061F6D7 /* DSActionSheet.h */, 140 | C4EEBCEC1DF1159A0061F6D7 /* DSActionSheet.m */, 141 | C4EEBCED1DF1159A0061F6D7 /* DSAlert.h */, 142 | C4EEBCEE1DF1159A0061F6D7 /* DSAlert.m */, 143 | C4EEBCEF1DF1159A0061F6D7 /* DSTableCell.h */, 144 | C4EEBCF01DF1159A0061F6D7 /* DSTableCell.m */, 145 | C4EEBCF11DF1159A0061F6D7 /* DSTableCell.xib */, 146 | C4EEBCF21DF1159A0061F6D7 /* UIView+AutoLayout.h */, 147 | C4EEBCF31DF1159A0061F6D7 /* UIView+AutoLayout.m */, 148 | ); 149 | path = DSAlert; 150 | sourceTree = ""; 151 | }; 152 | /* End PBXGroup section */ 153 | 154 | /* Begin PBXNativeTarget section */ 155 | C4EA7C1D1D7AD19D00D790CA /* DSAlert-OC */ = { 156 | isa = PBXNativeTarget; 157 | buildConfigurationList = C4EA7C351D7AD19D00D790CA /* Build configuration list for PBXNativeTarget "DSAlert-OC" */; 158 | buildPhases = ( 159 | C4EA7C1A1D7AD19D00D790CA /* Sources */, 160 | C4EA7C1B1D7AD19D00D790CA /* Frameworks */, 161 | C4EA7C1C1D7AD19D00D790CA /* Resources */, 162 | ); 163 | buildRules = ( 164 | ); 165 | dependencies = ( 166 | ); 167 | name = "DSAlert-OC"; 168 | productName = "DSAlert-OC"; 169 | productReference = C4EA7C1E1D7AD19D00D790CA /* DSAlert-OC.app */; 170 | productType = "com.apple.product-type.application"; 171 | }; 172 | /* End PBXNativeTarget section */ 173 | 174 | /* Begin PBXProject section */ 175 | C4EA7C161D7AD19D00D790CA /* Project object */ = { 176 | isa = PBXProject; 177 | attributes = { 178 | LastUpgradeCheck = 0720; 179 | ORGANIZATIONNAME = "DS-Team"; 180 | TargetAttributes = { 181 | C4EA7C1D1D7AD19D00D790CA = { 182 | CreatedOnToolsVersion = 7.2; 183 | DevelopmentTeam = 5MLEPWQRVD; 184 | }; 185 | }; 186 | }; 187 | buildConfigurationList = C4EA7C191D7AD19D00D790CA /* Build configuration list for PBXProject "DSAlert-OC" */; 188 | compatibilityVersion = "Xcode 3.2"; 189 | developmentRegion = English; 190 | hasScannedForEncodings = 0; 191 | knownRegions = ( 192 | en, 193 | Base, 194 | ); 195 | mainGroup = C4EA7C151D7AD19D00D790CA; 196 | productRefGroup = C4EA7C1F1D7AD19D00D790CA /* Products */; 197 | projectDirPath = ""; 198 | projectRoot = ""; 199 | targets = ( 200 | C4EA7C1D1D7AD19D00D790CA /* DSAlert-OC */, 201 | ); 202 | }; 203 | /* End PBXProject section */ 204 | 205 | /* Begin PBXResourcesBuildPhase section */ 206 | C4EA7C1C1D7AD19D00D790CA /* Resources */ = { 207 | isa = PBXResourcesBuildPhase; 208 | buildActionMask = 2147483647; 209 | files = ( 210 | C4EA7C511D7AD26100D790CA /* 背景.jpg in Resources */, 211 | 613B1CA01D81593300625FFF /* Alert6.xib in Resources */, 212 | C4EA7C311D7AD19D00D790CA /* LaunchScreen.storyboard in Resources */, 213 | C4EA7C521D7AD26100D790CA /* 美女.jpg in Resources */, 214 | C4EA7C2E1D7AD19D00D790CA /* Assets.xcassets in Resources */, 215 | C474C7651D82A55D00D5637F /* VerCodeAlertView.xib in Resources */, 216 | C4EA7C4C1D7AD1EE00D790CA /* Main.storyboard in Resources */, 217 | C4EA7C501D7AD26100D790CA /* 123.png in Resources */, 218 | C4EEBCF81DF1159A0061F6D7 /* DSTableCell.xib in Resources */, 219 | ); 220 | runOnlyForDeploymentPostprocessing = 0; 221 | }; 222 | /* End PBXResourcesBuildPhase section */ 223 | 224 | /* Begin PBXSourcesBuildPhase section */ 225 | C4EA7C1A1D7AD19D00D790CA /* Sources */ = { 226 | isa = PBXSourcesBuildPhase; 227 | buildActionMask = 2147483647; 228 | files = ( 229 | C4EEBCF51DF1159A0061F6D7 /* DSActionSheet.m in Sources */, 230 | 613B1C9E1D81592900625FFF /* Alert6.m in Sources */, 231 | C4EA7C291D7AD19D00D790CA /* ViewController.m in Sources */, 232 | C4EEBCF61DF1159A0061F6D7 /* DSAlert.m in Sources */, 233 | C4EA7C4B1D7AD1EE00D790CA /* ViewController2.m in Sources */, 234 | C4EEBCF71DF1159A0061F6D7 /* DSTableCell.m in Sources */, 235 | C4EA7C261D7AD19D00D790CA /* AppDelegate.m in Sources */, 236 | C4EA7C231D7AD19D00D790CA /* main.m in Sources */, 237 | C4EEBCF91DF1159A0061F6D7 /* UIView+AutoLayout.m in Sources */, 238 | C474C7641D82A55D00D5637F /* VerCodeAlertView.m in Sources */, 239 | C4EEBCF41DF1159A0061F6D7 /* CALayer+Animation.m in Sources */, 240 | ); 241 | runOnlyForDeploymentPostprocessing = 0; 242 | }; 243 | /* End PBXSourcesBuildPhase section */ 244 | 245 | /* Begin PBXVariantGroup section */ 246 | C4EA7C2F1D7AD19D00D790CA /* LaunchScreen.storyboard */ = { 247 | isa = PBXVariantGroup; 248 | children = ( 249 | C4EA7C301D7AD19D00D790CA /* Base */, 250 | ); 251 | name = LaunchScreen.storyboard; 252 | sourceTree = ""; 253 | }; 254 | /* End PBXVariantGroup section */ 255 | 256 | /* Begin XCBuildConfiguration section */ 257 | C4EA7C331D7AD19D00D790CA /* Debug */ = { 258 | isa = XCBuildConfiguration; 259 | buildSettings = { 260 | ALWAYS_SEARCH_USER_PATHS = NO; 261 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 262 | CLANG_CXX_LIBRARY = "libc++"; 263 | CLANG_ENABLE_MODULES = YES; 264 | CLANG_ENABLE_OBJC_ARC = YES; 265 | CLANG_WARN_BOOL_CONVERSION = YES; 266 | CLANG_WARN_CONSTANT_CONVERSION = YES; 267 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 268 | CLANG_WARN_EMPTY_BODY = YES; 269 | CLANG_WARN_ENUM_CONVERSION = YES; 270 | CLANG_WARN_INT_CONVERSION = YES; 271 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 272 | CLANG_WARN_UNREACHABLE_CODE = YES; 273 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 274 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 275 | COPY_PHASE_STRIP = NO; 276 | DEBUG_INFORMATION_FORMAT = dwarf; 277 | ENABLE_STRICT_OBJC_MSGSEND = YES; 278 | ENABLE_TESTABILITY = YES; 279 | GCC_C_LANGUAGE_STANDARD = gnu99; 280 | GCC_DYNAMIC_NO_PIC = NO; 281 | GCC_NO_COMMON_BLOCKS = YES; 282 | GCC_OPTIMIZATION_LEVEL = 0; 283 | GCC_PREPROCESSOR_DEFINITIONS = ( 284 | "DEBUG=1", 285 | "$(inherited)", 286 | ); 287 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 288 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 289 | GCC_WARN_UNDECLARED_SELECTOR = YES; 290 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 291 | GCC_WARN_UNUSED_FUNCTION = YES; 292 | GCC_WARN_UNUSED_VARIABLE = YES; 293 | IPHONEOS_DEPLOYMENT_TARGET = 9.2; 294 | MTL_ENABLE_DEBUG_INFO = YES; 295 | ONLY_ACTIVE_ARCH = YES; 296 | SDKROOT = iphoneos; 297 | TARGETED_DEVICE_FAMILY = "1,2"; 298 | }; 299 | name = Debug; 300 | }; 301 | C4EA7C341D7AD19D00D790CA /* Release */ = { 302 | isa = XCBuildConfiguration; 303 | buildSettings = { 304 | ALWAYS_SEARCH_USER_PATHS = NO; 305 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 306 | CLANG_CXX_LIBRARY = "libc++"; 307 | CLANG_ENABLE_MODULES = YES; 308 | CLANG_ENABLE_OBJC_ARC = YES; 309 | CLANG_WARN_BOOL_CONVERSION = YES; 310 | CLANG_WARN_CONSTANT_CONVERSION = YES; 311 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 312 | CLANG_WARN_EMPTY_BODY = YES; 313 | CLANG_WARN_ENUM_CONVERSION = YES; 314 | CLANG_WARN_INT_CONVERSION = YES; 315 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 316 | CLANG_WARN_UNREACHABLE_CODE = YES; 317 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 318 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 319 | COPY_PHASE_STRIP = NO; 320 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 321 | ENABLE_NS_ASSERTIONS = NO; 322 | ENABLE_STRICT_OBJC_MSGSEND = YES; 323 | GCC_C_LANGUAGE_STANDARD = gnu99; 324 | GCC_NO_COMMON_BLOCKS = YES; 325 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 326 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 327 | GCC_WARN_UNDECLARED_SELECTOR = YES; 328 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 329 | GCC_WARN_UNUSED_FUNCTION = YES; 330 | GCC_WARN_UNUSED_VARIABLE = YES; 331 | IPHONEOS_DEPLOYMENT_TARGET = 9.2; 332 | MTL_ENABLE_DEBUG_INFO = NO; 333 | SDKROOT = iphoneos; 334 | TARGETED_DEVICE_FAMILY = "1,2"; 335 | VALIDATE_PRODUCT = YES; 336 | }; 337 | name = Release; 338 | }; 339 | C4EA7C361D7AD19D00D790CA /* Debug */ = { 340 | isa = XCBuildConfiguration; 341 | buildSettings = { 342 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 343 | CODE_SIGN_IDENTITY = "iPhone Developer"; 344 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 345 | FRAMEWORK_SEARCH_PATHS = ( 346 | "$(inherited)", 347 | "$(PROJECT_DIR)/DSAlert-OC", 348 | ); 349 | INFOPLIST_FILE = "DSAlert-OC/Info.plist"; 350 | IPHONEOS_DEPLOYMENT_TARGET = 7.0; 351 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 352 | PRODUCT_BUNDLE_IDENTIFIER = "com.youren.DSAlert-OC"; 353 | PRODUCT_NAME = "$(TARGET_NAME)"; 354 | PROVISIONING_PROFILE = ""; 355 | }; 356 | name = Debug; 357 | }; 358 | C4EA7C371D7AD19D00D790CA /* Release */ = { 359 | isa = XCBuildConfiguration; 360 | buildSettings = { 361 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 362 | CODE_SIGN_IDENTITY = "iPhone Developer"; 363 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 364 | FRAMEWORK_SEARCH_PATHS = ( 365 | "$(inherited)", 366 | "$(PROJECT_DIR)/DSAlert-OC", 367 | ); 368 | INFOPLIST_FILE = "DSAlert-OC/Info.plist"; 369 | IPHONEOS_DEPLOYMENT_TARGET = 7.0; 370 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 371 | PRODUCT_BUNDLE_IDENTIFIER = "com.youren.DSAlert-OC"; 372 | PRODUCT_NAME = "$(TARGET_NAME)"; 373 | PROVISIONING_PROFILE = ""; 374 | }; 375 | name = Release; 376 | }; 377 | /* End XCBuildConfiguration section */ 378 | 379 | /* Begin XCConfigurationList section */ 380 | C4EA7C191D7AD19D00D790CA /* Build configuration list for PBXProject "DSAlert-OC" */ = { 381 | isa = XCConfigurationList; 382 | buildConfigurations = ( 383 | C4EA7C331D7AD19D00D790CA /* Debug */, 384 | C4EA7C341D7AD19D00D790CA /* Release */, 385 | ); 386 | defaultConfigurationIsVisible = 0; 387 | defaultConfigurationName = Release; 388 | }; 389 | C4EA7C351D7AD19D00D790CA /* Build configuration list for PBXNativeTarget "DSAlert-OC" */ = { 390 | isa = XCConfigurationList; 391 | buildConfigurations = ( 392 | C4EA7C361D7AD19D00D790CA /* Debug */, 393 | C4EA7C371D7AD19D00D790CA /* Release */, 394 | ); 395 | defaultConfigurationIsVisible = 0; 396 | defaultConfigurationName = Release; 397 | }; 398 | /* End XCConfigurationList section */ 399 | }; 400 | rootObject = C4EA7C161D7AD19D00D790CA /* Project object */; 401 | } 402 | -------------------------------------------------------------------------------- /DSAlert-OC/ViewController.m: -------------------------------------------------------------------------------- 1 | 2 | /*! 3 | * @brief DSAlert-OC 4 | * 5 | * @author DS-Team 6 | * @copyright Copyright © 2016年 DS-Team. All rights reserved. 7 | * @version V1.0.0 8 | */ 9 | 10 | /* 11 | *************************** DSAlert 项目简介: ********************** 12 | 13 | 1、开发人员【DS-Team】: 14 | 孙博岩:[『https://github.com/boai』](https://github.com/boai)
15 | 陆晓峰:[『https://github.com/zeR0Lu』](https://github.com/zeR0Lu)
16 | 陈集 :[『https://github.com/chenjipdc』](https://github.com/chenjipdc) 17 | 2、项目源码地址: 18 | OC版 :https://github.com/DS-Team/DSAlert-OC 19 | swift版:https://github.com/DS-Team/DSAlert-swift 20 | 3、安装及使用方式: 21 | * 3.1、pod 导入【当前最新版本:1.0.0】: 22 | pod 'DSAlert' 23 | 导入头文件:#import 24 | * 3.2、下载demo,把 DSAlert 文件夹拖入项目即可, 25 | 导入头文件:#import "DSAlert.h" 26 | 4、如果开发中遇到特殊情况或者bug,请及时反馈给我们,谢谢! 27 | 5、也可以加入我们的大家庭:QQ群 【 479663605 】,希望广大小白和大神能够积极加入! 28 | 29 | */ 30 | 31 | 32 | #import "ViewController.h" 33 | #import "Alert6.h" 34 | #import "UIView+AutoLayout.h" 35 | #import "VerCodeAlertView.h" 36 | #import "ViewController2.h" 37 | 38 | /*! 使用方法一:文件夹拖入 */ 39 | #import "DSAlert.h" 40 | #import "DSActionSheet.h" 41 | 42 | ///*! 使用方法二:pod */ 43 | //#import 44 | // 45 | ///*! 使用方法三:frameWork */ 46 | //#import 47 | 48 | 49 | static NSString * const titleMsg1 = @"欢迎使用 iPhone SE,迄今最高性能的 4 英寸 iPhone。在打造这款手机时,我们在深得人心的 4 英寸设计基础上,从里到外重新构想。它所采用的 A9 芯片,正是在 iPhone 6s 上使用的先进芯片。1200 万像素的摄像头能拍出令人叹为观止的精彩照片和 4K 视频,而 Live Photos 则会让你的照片栩栩如生。这一切,成就了一款外形小巧却异常强大的 iPhone。"; 50 | static NSString * const titleMsg2 = @"对于 MacBook,我们给自己设定了一个几乎不可能实现的目标:在有史以来最为轻盈纤薄的 Mac 笔记本电脑上,打造全尺寸的使用体验。这就要求每个元素都必须重新构想,不仅令其更为纤薄轻巧,还要更加出色。最终我们带来的,不仅是一部新款的笔记本电脑,更是一种对笔记本电脑的前瞻性思考。现在,有了第六代 Intel 处理器、提升的图形处理性能、高速闪存和最长可达 10 小时的电池使用时间*,MacBook 的强大更进一步。"; 51 | 52 | @interface ViewController () 53 | @property (weak, nonatomic ) IBOutlet UITableView *tableView; 54 | 55 | @property (nonatomic, strong) DSAlert *alertView1; 56 | @property (nonatomic, strong) DSAlert *alertView2; 57 | @property (nonatomic, strong) DSAlert *alertView3; 58 | @property (nonatomic, strong) DSAlert *alertView4; 59 | @property (nonatomic, strong) DSAlert *alertView5; 60 | 61 | @property (nonatomic, strong) DSActionSheet *actionSheet1; 62 | @property (nonatomic, strong) DSActionSheet *actionSheet2; 63 | @property (nonatomic, strong) DSActionSheet *actionSheet3; 64 | 65 | 66 | @property (nonatomic, strong) UIView *viewPwdBgView; 67 | @property (nonatomic, strong) UITextField *pwdTextField; 68 | 69 | @property (nonatomic,strong ) UIButton *chooseBtn; 70 | @property (nonatomic,strong ) UILabel *titleLabel; 71 | 72 | @property (strong, nonatomic) NSArray *dataArray; 73 | 74 | @end 75 | 76 | @implementation ViewController 77 | 78 | - (NSArray *)dataArray 79 | { 80 | if ( !_dataArray ) 81 | { 82 | _dataArray = [NSArray arrayWithObjects:@[@"1、类似系统alert【加边缘手势消失】", 83 | @"2、自定义按钮颜色", 84 | @"3、自定义背景图片", 85 | @"4、内置图片和文字,可滑动查看", 86 | @"5、完全自定义alert", 87 | @"6、完全自定义alert-autolayout", 88 | @"7、终于可以愉快的 pod 导入了,pod 导入:` pod 'DSAlert-OC' ` 【最新版本:1.0.8】" 89 | ], 90 | @[@"1、actionsheet", 91 | @"2、actionsheet带标题", 92 | @"3、actionsheet带标题带图片"], 93 | @[@"DSAlert特点:\n1、手势触摸隐藏开关,可随时开关\n2、可以自定义背景图片、背景颜色、按钮颜色\n3、可以添加文字和图片,且可以滑动查看!\n4、横竖屏适配完美\n5、有各种炫酷动画展示你的alert\n6、可以自定义按钮颜色\n7、理论完全兼容现有所有 iOS 系统版本" 94 | ], nil]; 95 | } 96 | return _dataArray; 97 | } 98 | 99 | - (void)viewDidLoad 100 | { 101 | [super viewDidLoad]; 102 | 103 | self.tableView.estimatedRowHeight = 44.f; 104 | self.tableView.rowHeight = UITableViewAutomaticDimension; 105 | 106 | self.title = @"DSAlert-OC"; 107 | } 108 | 109 | #pragma mark - UITableViewDataSource / UITableViewDelegate 110 | - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView 111 | { 112 | return self.dataArray.count; 113 | } 114 | 115 | - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section 116 | { 117 | return [self.dataArray[section] count]; 118 | } 119 | 120 | - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath 121 | { 122 | static NSString *identifier = @"cell"; 123 | UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:identifier]; 124 | 125 | if ( !cell ) 126 | { 127 | cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:identifier]; 128 | cell.textLabel.numberOfLines = 0; 129 | 130 | cell.accessoryType = 0 == indexPath.section?UITableViewCellAccessoryDisclosureIndicator:UITableViewCellAccessoryNone; 131 | cell.selectionStyle = 0 == indexPath.section?UITableViewCellSelectionStyleDefault:UITableViewCellSelectionStyleNone; 132 | } 133 | NSArray *tempArray = self.dataArray[indexPath.section]; 134 | cell.textLabel.text = tempArray[indexPath.row]; 135 | return cell; 136 | } 137 | 138 | - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath 139 | { 140 | DSWeak; 141 | if ( 0 == indexPath.section ) 142 | { 143 | [self showAlertAction:indexPath.row + 1]; 144 | }else if ( 1 == indexPath.section ) 145 | { 146 | switch ( indexPath.row ) { 147 | case 0: 148 | { 149 | [DSActionSheet ds_showActionSheetWithStyle:DSCustomActionSheetStyleNormal 150 | contentArray:@[@"测试1",@"测试2",@"测试3"] 151 | imageArray:nil 152 | redIndex:1 153 | title:nil 154 | configuration:^(DSActionSheet *tempView) { 155 | weakSelf.actionSheet1 = tempView; 156 | } ClikckButtonIndex:^(NSInteger index) { 157 | NSLog(@"你点击了第 %ld 行!",(long)index); 158 | [weakSelf.actionSheet1 ds_dismissDSActionSheet]; 159 | }]; 160 | 161 | } 162 | break; 163 | case 1: 164 | { 165 | [DSActionSheet ds_showActionSheetWithStyle:DSCustomActionSheetStyleTitle 166 | contentArray:@[@"测试1",@"测试2",@"测试3"] 167 | imageArray:nil 168 | redIndex:1 169 | title:@"测试带标题的ActionSheet" 170 | configuration:^(DSActionSheet *tempView) { 171 | weakSelf.actionSheet1 = tempView; 172 | } ClikckButtonIndex:^(NSInteger index) { 173 | NSLog(@"你点击了第 %ld 行!",(long)index); 174 | [weakSelf.actionSheet1 ds_dismissDSActionSheet]; 175 | }]; 176 | } 177 | break; 178 | case 2: 179 | { 180 | [DSActionSheet ds_showActionSheetWithStyle:DSCustomActionSheetStyleImageAndTitle 181 | contentArray:@[@"测试1",@"测试2",@"测试3"] 182 | imageArray:@[[UIImage imageNamed:@"123.png"],[UIImage imageNamed:@"背景.jpg"],[UIImage imageNamed:@"美女.jpg"]] 183 | redIndex:1 184 | title:@"测试带标题和图片的ActionSheet" 185 | configuration:^(DSActionSheet *tempView) { 186 | weakSelf.actionSheet1 = tempView; 187 | } ClikckButtonIndex:^(NSInteger index) { 188 | NSLog(@"你点击了第 %ld 行!",(long)index); 189 | [weakSelf.actionSheet1 ds_dismissDSActionSheet]; 190 | }]; 191 | } 192 | break; 193 | default: 194 | break; 195 | } 196 | } 197 | [tableView deselectRowAtIndexPath:indexPath animated:YES]; 198 | } 199 | 200 | - (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section 201 | { 202 | UIView *headerView = [UIView new]; 203 | 204 | UILabel *headerTitle = [UILabel new]; 205 | headerTitle.font = [UIFont systemFontOfSize:14]; 206 | headerTitle.textColor = [UIColor redColor]; 207 | headerTitle.numberOfLines = 0; 208 | [headerView addSubview:headerTitle]; 209 | 210 | if (0 == section) 211 | { 212 | headerTitle.frame = CGRectMake(20, 0, SCREENWIDTH - 40, 40); 213 | headerTitle.text = @"DSAlert 的几种日常用法,高斯模糊、炫酷动画,应有尽有!"; 214 | } 215 | else if (1 == section) 216 | { 217 | headerTitle.frame = CGRectMake(20, 0, SCREENWIDTH - 40, 20); 218 | headerTitle.text = @"DSActionSheet"; 219 | } 220 | 221 | return headerView; 222 | } 223 | 224 | - (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section 225 | { 226 | return (0 == section) ? 40 : 20; 227 | } 228 | 229 | - (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section 230 | { 231 | return FLT_MIN; 232 | } 233 | 234 | - (void)didReceiveMemoryWarning 235 | { 236 | [super didReceiveMemoryWarning]; 237 | // Dispose of any resources that can be recreated. 238 | } 239 | 240 | #pragma mark - 点击事件 241 | - (void)showAlertAction:(NSInteger)index 242 | { 243 | switch (index) { 244 | case 1: 245 | [self performSelector:@selector(alert1)]; 246 | break; 247 | case 2: 248 | [self performSelector:@selector(alert2)]; 249 | break; 250 | case 3: 251 | [self performSelector:@selector(alert3)]; 252 | break; 253 | case 4: 254 | [self performSelector:@selector(alert4)]; 255 | break; 256 | case 5: 257 | [self performSelector:@selector(alert5)]; 258 | break; 259 | case 6: 260 | [self alert6]; 261 | break; 262 | default: 263 | break; 264 | } 265 | } 266 | 267 | - (void)alert1 268 | { 269 | DSWeak; 270 | /*! 第一种封装使用示例 */ 271 | [DSAlert ds_showAlertWithTitle:@"温馨提示:" message:titleMsg1 image:nil buttonTitles:@[@"取消",@"确定",@"确定2",@"确定3"] buttonTitlesColor:@[[UIColor redColor], [UIColor greenColor], [UIColor grayColor], [UIColor purpleColor]] configuration:^(DSAlert *temp) { 272 | 273 | // temp.bgColor = [UIColor colorWithRed:0 green:1.0 blue:0 alpha:0.3]; 274 | /*! 开启边缘触摸隐藏alertView */ 275 | temp.isTouchEdgeHide = YES; 276 | /*! 添加高斯模糊的样式 , [UIColor purpleColor]*/ 277 | temp.blurEffectStyle = DSAlertBlurEffectStyleLight; 278 | /*! 开启动画 */ 279 | // temp.isShowAnimate = YES; 280 | // /*! 进出场动画样式 默认为:1 */ 281 | // temp.animatingStyle = 1; 282 | }actionClick:^(NSInteger index) { 283 | if (index == 0) 284 | { 285 | NSLog(@"点击了取消按钮!"); 286 | /*! 隐藏alert */ 287 | // [weakSelf.alertView1 ds_dismissAlertView]; 288 | } 289 | else if (index == 1) 290 | { 291 | NSLog(@"点击了确定按钮!"); 292 | ViewController2 *vc2 = [ViewController2 new]; 293 | vc2.title = @"alert1"; 294 | [weakSelf.navigationController pushViewController:vc2 animated:YES]; 295 | /*! 隐藏alert */ 296 | // [weakSelf.alertView1 ds_dismissAlertView]; 297 | } 298 | }]; 299 | 300 | /*! 第二种常用方法使用示例 */ 301 | 302 | // /*! 1、类似系统alert【加边缘手势消失】 */ 303 | // _alertView1 = [[DSAlert alloc] ds_showTitle:@"温馨提示:" 304 | // 305 | // image:nil 306 | // buttonTitles:@[@"取消", @"确定"]]; 307 | // _alertView1.bgColor = [UIColor colorWithRed:0 green:1.0 blue:0 alpha:0.3]; 308 | // /*! 是否开启边缘触摸隐藏 alert */ 309 | // _alertView1.isTouchEdgeHide = YES; 310 | // /*! 显示alert */ 311 | // [_alertView1 ds_showAlertView]; 312 | // 313 | // DSWeak; 314 | // _alertView1.buttonActionBlock = ^(NSInteger index){ 315 | // if (index == 0) 316 | // { 317 | // NSLog(@"点击了取消按钮!"); 318 | // /*! 隐藏alert */ 319 | //// [weakSelf.alertView1 ds_dismissAlertView]; 320 | // } 321 | // else if (index == 1) 322 | // { 323 | // NSLog(@"点击了确定按钮!"); 324 | // ViewController2 *vc2 = [ViewController2 new]; 325 | // vc2.title = @"alert1"; 326 | // [weakSelf.navigationController pushViewController:vc2 animated:YES]; 327 | // /*! 隐藏alert */ 328 | //// [weakSelf.alertView1 ds_dismissAlertView]; 329 | // } 330 | // }; 331 | } 332 | 333 | - (void)alert2 334 | { 335 | /*! 2、自定义按钮颜色 */ 336 | _alertView2 = [[DSAlert alloc] ds_showTitle:@"温馨提示:" 337 | message:titleMsg2 338 | image:nil 339 | buttonTitles:@[@"取消", @"跳转VC2"] buttonTitlesColor:@[[UIColor redColor], [UIColor greenColor]]]; 340 | /*! 自定义按钮文字颜色 */ 341 | // _alertView2.buttonTitleColor = [UIColor orangeColor]; 342 | _alertView2.bgColor = [UIColor colorWithRed:1.0 green:1.0 blue:0 alpha:0.3]; 343 | 344 | /*! 是否开启进出场动画 默认:NO,如果 YES ,并且同步设置进出场动画枚举为默认值:1 */ 345 | _alertView2.showAnimate = YES; 346 | 347 | /*! 显示alert */ 348 | [_alertView2 ds_showAlertView]; 349 | DSWeak; 350 | _alertView2.buttonActionBlock = ^(NSInteger index){ 351 | if (index == 0) 352 | { 353 | NSLog(@"点击了取消按钮!"); 354 | /*! 隐藏alert */ 355 | [weakSelf.alertView2 ds_dismissAlertView]; 356 | } 357 | else if (index == 1) 358 | { 359 | NSLog(@"点击了确定按钮!"); 360 | ViewController2 *vc2 = [ViewController2 new]; 361 | vc2.title = @"alert2"; 362 | [weakSelf.navigationController pushViewController:vc2 animated:YES]; 363 | /*! 隐藏alert */ 364 | // [weakSelf.alertView2 ds_dismissAlertView]; 365 | } 366 | }; 367 | } 368 | 369 | - (void)alert3 370 | { 371 | /*! 3、自定义背景图片 */ 372 | _alertView3 = [[DSAlert alloc] ds_showTitle:@"温馨提示:" 373 | message:titleMsg1 374 | image:nil 375 | buttonTitles:@[@"取消", @"确定"]buttonTitlesColor:@[[UIColor redColor], [UIColor greenColor]]]; 376 | /*! 自定义按钮文字颜色 */ 377 | // _alertView3.buttonTitleColor = [UIColor orangeColor]; 378 | /*! 自定义alert的背景图片 */ 379 | _alertView3.bgImageName = @"背景.jpg"; 380 | /*! 开启动画,并且设置动画样式,默认:1 */ 381 | // _alertView3.isShowAnimate = YES; 382 | 383 | /*! 没有开启动画,直接进出场动画样式,默认开启动画 */ 384 | _alertView3.animatingStyle = DSAlertAnimatingStyleFall; 385 | 386 | /*! 显示alert */ 387 | [_alertView3 ds_showAlertView]; 388 | DSWeak; 389 | _alertView3.buttonActionBlock = ^(NSInteger index){ 390 | if (index == 0) 391 | { 392 | NSLog(@"点击了取消按钮!"); 393 | /*! 隐藏alert */ 394 | // [weakSelf.alertView3 ds_dismissAlertView]; 395 | } 396 | else if (index == 1) 397 | { 398 | NSLog(@"点击了确定按钮!"); 399 | ViewController2 *vc2 = [ViewController2 new]; 400 | vc2.title = @"alert3"; 401 | [weakSelf.navigationController pushViewController:vc2 animated:YES]; 402 | /*! 隐藏alert */ 403 | // [weakSelf.alertView3 ds_dismissAlertView]; 404 | } 405 | }; 406 | } 407 | 408 | - (void)alert4 409 | { 410 | /*! 4、内置图片和文字,可滑动查看 */ 411 | _alertView4 = [[DSAlert alloc] ds_showTitle:@"温馨提示:" 412 | message:titleMsg1 413 | image:[UIImage imageNamed:@"美女.jpg"] 414 | buttonTitles:@[@"取消", @"跳转VC2"] buttonTitlesColor:@[[UIColor redColor], [UIColor greenColor]]]; 415 | /*! 自定义按钮文字颜色 */ 416 | // _alertView4.buttonTitleColor = [UIColor orangeColor]; 417 | /*! 自定义alert的背景图片 */ 418 | _alertView4.bgImageName = @"背景.jpg"; 419 | /*! 是否显示动画效果 */ 420 | _alertView4.showAnimate = YES; 421 | /*! 显示alert */ 422 | [_alertView4 ds_showAlertView]; 423 | DSWeak; 424 | _alertView4.buttonActionBlock = ^(NSInteger index){ 425 | if (index == 0) 426 | { 427 | NSLog(@"点击了取消按钮!"); 428 | /*! 隐藏alert */ 429 | // [weakSelf.alertView4 ds_dismissAlertView]; 430 | } 431 | else if (index == 1) 432 | { 433 | NSLog(@"点击了确定按钮!"); 434 | ViewController2 *vc2 = [ViewController2 new]; 435 | vc2.title = @"alert4"; 436 | [weakSelf.navigationController pushViewController:vc2 animated:YES]; 437 | /*! 隐藏alert */ 438 | // [weakSelf.alertView4 ds_dismissAlertView]; 439 | } 440 | }; 441 | } 442 | 443 | - (void)alert5 444 | { 445 | /*! 5、完全自定义alert */ 446 | 447 | /*! 纯代码加载方式 【建议用 xib 方式】*/ 448 | /*! 用纯代码的时候,记得这里的自定义 View 不能用懒加载,要不然点击第二次就不会在出现那个自定义 View 了 */ 449 | [self setViewPwdBgView]; 450 | // self.viewPwdBgView.hidden = NO; 451 | // _alertView5 = [[DSAlert alloc] initWithCustomView:self.viewPwdBgView]; 452 | // _alertView5.isTouchEdgeHide = YES; 453 | // _alertView5.showAnimate = YES; 454 | // [_alertView5 ds_showAlertView]; 455 | 456 | DSWeak; 457 | [DSAlert ds_showCustomView:self.viewPwdBgView configuration:^(DSAlert *tempView) { 458 | tempView.isTouchEdgeHide = YES; 459 | tempView.animatingStyle = DSAlertAnimatingStyleScale; 460 | weakSelf.alertView5 = tempView; 461 | }]; 462 | 463 | /*! xib 加载方式 【建议用 xib 方式】*/ 464 | // NSArray *nib = [[NSBundle mainBundle]loadNibNamed:@"VerCodeAlertView" owner:self options:nil]; 465 | // UIView *view1 = nib[0]; 466 | // [DSAlert ds_showCustomView:view1 configuration:^(DSAlert *tempView) { 467 | // tempView.isTouchEdgeHide = YES; 468 | // tempView.animatingStyle = DSAlertAnimatingStyleScale; 469 | // weakSelf.alertView5 = tempView; 470 | // }]; 471 | } 472 | 473 | - (void)alert6 { 474 | DSWeak; 475 | Alert6 *view = [Alert6 makeViewWithFrame:CGRectMake(30, 100, SCREENWIDTH - 60, 200) Title:@"测试AutoLayout方法" buttonTitles:@[@"取消",@"确定"] buttonBlock:^(NSInteger index) { 476 | NSLog(@"%ld",(long)index); 477 | 478 | [weakSelf.alertView5 ds_dismissAlertView]; 479 | }]; 480 | view.layer.masksToBounds = true; 481 | view.layer.cornerRadius = 8.0; 482 | view.translatesAutoresizingMaskIntoConstraints = false; 483 | _alertView5 = [[DSAlert alloc] initWithCustomView:view]; 484 | 485 | _alertView5.showAnimate = YES; 486 | [_alertView5 ds_showAlertView]; 487 | } 488 | 489 | //- (void)cancleButtonAction:(UIButton *)sender 490 | //{ 491 | // NSLog(@"点击了取消按钮!"); 492 | // /*! 隐藏alert */ 493 | // [_alertView5 ds_dismissAlertView]; 494 | //} 495 | 496 | 497 | 498 | - (BOOL)prefersStatusBarHidden { 499 | return false; 500 | } 501 | 502 | - (void)setViewPwdBgView 503 | { 504 | // if (!_viewPwdBgView) 505 | // { 506 | _viewPwdBgView = [UIView new]; 507 | _viewPwdBgView.frame = CGRectMake(30, 100, SCREENWIDTH - 60, 160); 508 | 509 | _viewPwdBgView.backgroundColor = [UIColor whiteColor]; 510 | _viewPwdBgView.layer.masksToBounds = YES; 511 | _viewPwdBgView.layer.cornerRadius = 10.0f; 512 | 513 | CGFloat buttonWith = (SCREENWIDTH - 60)/2 - 0.5; 514 | CGFloat buttonHeight = 40; 515 | 516 | UILabel *titleLabel = [UILabel new]; 517 | titleLabel.frame = CGRectMake(0, 0, _viewPwdBgView.frame.size.width, buttonHeight); 518 | titleLabel.text = @"请输入观看密码"; 519 | titleLabel.textAlignment = NSTextAlignmentCenter; 520 | titleLabel.font = [UIFont systemFontOfSize:18]; 521 | titleLabel.backgroundColor = [UIColor clearColor]; 522 | 523 | UIView *lineView1 = [UIView new]; 524 | lineView1.frame = CGRectMake(0, CGRectGetMaxY(titleLabel.frame), _viewPwdBgView.frame.size.width, 1); 525 | lineView1.backgroundColor = [UIColor lightGrayColor]; 526 | 527 | _pwdTextField = [UITextField new]; 528 | _pwdTextField.frame = CGRectMake(20, CGRectGetMaxY(lineView1.frame) + 20, _viewPwdBgView.frame.size.width - 40, buttonHeight); 529 | _pwdTextField.borderStyle = UITextBorderStyleRoundedRect; 530 | _pwdTextField.keyboardType = UIKeyboardTypeNumberPad; 531 | _pwdTextField.secureTextEntry = YES; 532 | _pwdTextField.textAlignment = NSTextAlignmentCenter; 533 | _pwdTextField.contentVerticalAlignment = UIControlContentVerticalAlignmentCenter; 534 | // _pwdTextField.autoresizingMask = UIViewAutoresizingFlexibleWidth; 535 | [_pwdTextField becomeFirstResponder]; 536 | 537 | UIView *lineView2 = [UIView new]; 538 | lineView2.frame = CGRectMake(0, _viewPwdBgView.frame.size.height - 41, _viewPwdBgView.frame.size.width, 1); 539 | lineView2.backgroundColor = [UIColor lightGrayColor]; 540 | 541 | UIButton *cancleButton = [[UIButton alloc]initWithFrame:CGRectMake(0, CGRectGetMaxY(lineView2.frame), buttonWith, buttonHeight)]; 542 | [cancleButton setTitle:@"取消" forState:UIControlStateNormal]; 543 | [cancleButton setBackgroundColor:[UIColor clearColor]]; 544 | [cancleButton setTitleColor:[UIColor blackColor] forState:UIControlStateNormal]; 545 | [cancleButton addTarget:self action:@selector(cancleButtonAction:) forControlEvents:UIControlEventTouchUpInside]; 546 | // cancleButton.autoresizingMask = UIViewAutoresizingFlexibleWidth|UIViewAutoresizingFlexibleLeftMargin|UIViewAutoresizingFlexibleRightMargin; 547 | 548 | UIView *lineView3 = [UIView new]; 549 | lineView3.frame = CGRectMake(buttonWith, CGRectGetMinY(cancleButton.frame), 1, buttonHeight); 550 | lineView3.backgroundColor = [UIColor lightGrayColor]; 551 | 552 | UIButton *sureButton = [[UIButton alloc]initWithFrame:CGRectMake(CGRectGetMaxX(lineView3.frame), CGRectGetMinY(cancleButton.frame), buttonWith, buttonHeight)]; 553 | [sureButton setTitle:@"确定" forState:UIControlStateNormal]; 554 | [sureButton setBackgroundColor:[UIColor clearColor]]; 555 | [sureButton setTitleColor:[UIColor blackColor] forState:UIControlStateNormal]; 556 | [sureButton addTarget:self action:@selector(cancleButtonAction:) forControlEvents:UIControlEventTouchUpInside]; 557 | // sureButton.autoresizingMask = UIViewAutoresizingFlexibleWidth|UIViewAutoresizingFlexibleLeftMargin|UIViewAutoresizingFlexibleRightMargin; 558 | 559 | cancleButton.tag = 1; 560 | sureButton.tag = 2; 561 | 562 | [_viewPwdBgView addSubview:titleLabel]; 563 | [_viewPwdBgView addSubview:lineView1]; 564 | [_viewPwdBgView addSubview:_pwdTextField]; 565 | [_viewPwdBgView addSubview:lineView2]; 566 | [_viewPwdBgView addSubview:cancleButton]; 567 | [_viewPwdBgView addSubview:lineView3]; 568 | [_viewPwdBgView addSubview:sureButton]; 569 | 570 | // //这里是让titleLabel跟父view上左右边距为0,底部间距不设置 571 | // [titleLabel autoPinEdgesToSuperviewEdgesWithInsets:UIEdgeInsetsMake(0, 0, 0, 0) excludingEdge:ALEdgeBottom]; 572 | // //设置titleLabel的高度为buttonHeight 573 | // [titleLabel autoSetDimension:ALDimensionHeight toSize:buttonHeight]; 574 | // 575 | // //设置lineView1与父view左右间距为0,顶部和titleLabel的底部间距为0,高度为1 576 | // [lineView1 autoPinEdge:ALEdgeLeft toEdge:ALEdgeLeft ofView:_viewPwdBgView]; 577 | // [lineView1 autoPinEdge:ALEdgeRight toEdge:ALEdgeRight ofView:_viewPwdBgView]; 578 | // [lineView1 autoPinEdge:ALEdgeTop toEdge:ALEdgeBottom ofView:titleLabel]; 579 | // [lineView1 autoSetDimension:ALDimensionHeight toSize:1.0]; 580 | // 581 | // //设置_pwdTextField与父view左右间距为20,顶部和lineView1的底部间距为20,高度为buttonHeight 582 | // [_pwdTextField autoPinEdge:ALEdgeLeft toEdge:ALEdgeLeft ofView:_viewPwdBgView withOffset:20]; 583 | // [_pwdTextField autoPinEdge:ALEdgeRight toEdge:ALEdgeRight ofView:_viewPwdBgView withOffset:-20]; 584 | // [_pwdTextField autoPinEdge:ALEdgeTop toEdge:ALEdgeBottom ofView:lineView1 withOffset:20]; 585 | // [_pwdTextField autoSetDimension:ALDimensionHeight toSize:buttonHeight]; 586 | // 587 | // //这里是让lineView2跟父view上左右边距为0,顶部间距不设置,底部跟父view间距41,高度为buttonHeight 588 | // [lineView2 autoPinEdgesToSuperviewEdgesWithInsets:UIEdgeInsetsMake(0, 0, 41.0, 0) excludingEdge:ALEdgeTop]; 589 | // [lineView2 autoSetDimension:ALDimensionHeight toSize:1.0]; 590 | // 591 | // //设置cancleButton与父view左底间距为0,高度为buttonHeight,宽度为buttonWith 592 | // [cancleButton autoPinEdge:ALEdgeLeft toEdge:ALEdgeLeft ofView:_viewPwdBgView]; 593 | // [cancleButton autoPinEdge:ALEdgeBottom toEdge:ALEdgeBottom ofView:_viewPwdBgView]; 594 | // [cancleButton autoSetDimension:ALDimensionHeight toSize:buttonHeight]; 595 | // 596 | // //设置lineView3与父view底间距为0,高度为buttonHeight,左边与cancelButton的右间距为0,宽度为1 597 | // [lineView3 autoPinEdge:ALEdgeLeft toEdge:ALEdgeRight ofView:cancleButton]; 598 | // [lineView3 autoPinEdge:ALEdgeBottom toEdge:ALEdgeBottom ofView:_viewPwdBgView]; 599 | // [lineView3 autoSetDimension:ALDimensionHeight toSize:buttonHeight]; 600 | // [lineView3 autoSetDimension:ALDimensionWidth toSize:1]; 601 | // 602 | // //设置sureButton与父view底右间距为0,高度为buttonHeight,左边与cancelButton的右间距为0 603 | // [sureButton autoPinEdge:ALEdgeLeft toEdge:ALEdgeRight ofView:lineView3]; 604 | // [sureButton autoPinEdge:ALEdgeBottom toEdge:ALEdgeBottom ofView:_viewPwdBgView]; 605 | // [sureButton autoPinEdge:ALEdgeRight toEdge:ALEdgeRight ofView:_viewPwdBgView]; 606 | // [sureButton autoSetDimension:ALDimensionHeight toSize:buttonHeight]; 607 | // [sureButton autoMatchDimension:ALDimensionWidth toDimension:ALDimensionWidth ofView:cancleButton]; 608 | 609 | // } 610 | // return _viewPwdBgView; 611 | } 612 | 613 | - (void)cancleButtonAction:(UIButton *)sender 614 | { 615 | if (sender.tag == 1) 616 | { 617 | NSLog(@"点击了取消按钮!"); 618 | /*! 隐藏alert */ 619 | [_alertView5 ds_dismissAlertView]; 620 | [_pwdTextField resignFirstResponder]; 621 | 622 | [self.navigationController popViewControllerAnimated:YES]; 623 | } 624 | else 625 | { 626 | NSLog(@"点击了确定按钮!密码:%@", _pwdTextField.text); 627 | 628 | // WEAKSELF; 629 | if (_pwdTextField.text.length < 4 || _pwdTextField.text.length > 8 ) 630 | { 631 | self.pwdTextField.text = @""; 632 | [DSAlert ds_showAlertWithTitle:@"温馨提示:" message:@"请输入正确的密码!" image:nil buttonTitles:@[@"确定"] buttonTitlesColor:@[[UIColor redColor], [UIColor cyanColor]] configuration:^(DSAlert *tempView) { 633 | // weakSelf.alert2 = tempView; 634 | } actionClick:^(NSInteger index) { 635 | if (1 == index) 636 | { 637 | return; 638 | } 639 | }]; 640 | return; 641 | } 642 | /*! 隐藏alert */ 643 | [_alertView5 ds_dismissAlertView]; 644 | [_pwdTextField resignFirstResponder]; 645 | } 646 | } 647 | 648 | @end 649 | --------------------------------------------------------------------------------