├── .gitignore ├── DHAlertViewHUD ├── DHAlertViewHUD │ ├── DHAlertViewHUD.h │ ├── DHAlertViewHUD.m │ ├── UIImage+DHExtension.h │ ├── UIImage+DHExtension.m │ ├── UILabel+DHExtension.h │ └── UILabel+DHExtension.m ├── DHAlertViewHUDExample │ ├── DHAlertViewHUDExample.xcodeproj │ │ ├── project.pbxproj │ │ └── project.xcworkspace │ │ │ └── contents.xcworkspacedata │ ├── DHAlertViewHUDExample │ │ ├── Assets.xcassets │ │ │ └── AppIcon.appiconset │ │ │ │ └── Contents.json │ │ ├── Base.lproj │ │ │ ├── LaunchScreen.storyboard │ │ │ └── Main.storyboard │ │ ├── Classes │ │ │ ├── AppDelegate │ │ │ │ ├── AppDelegate.h │ │ │ │ └── AppDelegate.m │ │ │ └── ViewController │ │ │ │ ├── ViewController.h │ │ │ │ └── ViewController.m │ │ ├── Info.plist │ │ └── main.m │ ├── DHAlertViewHUDExampleTests │ │ ├── DHAlertViewHUDExampleTests.m │ │ └── Info.plist │ └── DHAlertViewHUDExampleUITests │ │ ├── DHAlertViewHUDExampleUITests.m │ │ └── Info.plist └── DesignSketchGIF │ ├── Untitled-1.gif │ └── Untitled-2.gif ├── LICENSE └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | # Xcode 2 | # 3 | # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore 4 | 5 | ## Build generated 6 | build/ 7 | DerivedData/ 8 | 9 | ## Various settings 10 | *.pbxuser 11 | !default.pbxuser 12 | *.mode1v3 13 | !default.mode1v3 14 | *.mode2v3 15 | !default.mode2v3 16 | *.perspectivev3 17 | !default.perspectivev3 18 | xcuserdata/ 19 | 20 | ## Other 21 | *.moved-aside 22 | *.xcuserstate 23 | 24 | ## Obj-C/Swift specific 25 | *.hmap 26 | *.ipa 27 | *.dSYM.zip 28 | *.dSYM 29 | 30 | # CocoaPods 31 | # 32 | # We recommend against adding the Pods directory to your .gitignore. However 33 | # you should judge for yourself, the pros and cons are mentioned at: 34 | # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control 35 | # 36 | # Pods/ 37 | 38 | # Carthage 39 | # 40 | # Add this line if you want to avoid checking in source code from Carthage dependencies. 41 | # Carthage/Checkouts 42 | 43 | Carthage/Build 44 | 45 | # fastlane 46 | # 47 | # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the 48 | # screenshots whenever they are needed. 49 | # For more information about the recommended setup visit: 50 | # https://github.com/fastlane/fastlane/blob/master/fastlane/docs/Gitignore.md 51 | 52 | fastlane/report.xml 53 | fastlane/screenshots 54 | 55 | #Code Injection 56 | # 57 | # After new code Injection tools there's a generated folder /iOSInjectionProject 58 | # https://github.com/johnno1962/injectionforxcode 59 | 60 | iOSInjectionProject/ 61 | -------------------------------------------------------------------------------- /DHAlertViewHUD/DHAlertViewHUD/DHAlertViewHUD.h: -------------------------------------------------------------------------------- 1 | // 2 | // DHAlertViewHUD.h 3 | // DHAlertViewHUD 4 | // 5 | // Created by Apple on 16/7/19. 6 | // Copyright © 2016年 dingding3w. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | typedef NS_ENUM(NSInteger , DDShowAlertViewAnimationStyle) { 12 | DDShowAlertViewAnimationStyleDefault = 0,// 缩放 13 | DDShowAlertViewAnimationStyleTop ,// 上 14 | DDShowAlertViewAnimationStyleLeft ,// 左 15 | DDShowAlertViewAnimationStyleBottom ,// 下 16 | DDShowAlertViewAnimationStyleRight ,// 右 17 | DDShowAlertViewAnimationStyleNO ,// 没有 18 | }; 19 | typedef void(^DDAlertViewHUDClickIndexBlock)(NSInteger alertViewClickIndex); 20 | 21 | typedef NS_ENUM(NSInteger, DDAlertViewButtonStyle) { 22 | DDAlertViewButtonStyleInline = 0, // 内联 23 | DDAlertViewButtonStylePlain, // 平铺 24 | }; 25 | 26 | @interface DHAlertViewHUD : UIView 27 | @property (nonatomic, copy ) DDAlertViewHUDClickIndexBlock alertViewClickBlock; 28 | @property (nonatomic, assign) DDShowAlertViewAnimationStyle alertViewAnimationStyle; 29 | @property (nonatomic, assign) DDAlertViewButtonStyle alertViewButtonStyle; 30 | 31 | /** 32 | * 自定义初始化DHAlertViewHUD 33 | * 34 | * @param title 标题 35 | * @param message 内容 36 | * @param cancelButtonTitle 按钮一 37 | * @param otherButtonTitle 按钮二 38 | * @param alertViewClickBlock 点击按钮回调Block(内联方法block) 39 | * 40 | * @return 自定义初始化DHAlertViewHUD对象 41 | */ 42 | - (instancetype)initWithTitle:(NSString *)title message:(NSString *)message cancelButtonTitle:(NSString *)cancelButtonTitle otherButtonTitle:(NSString *)otherButtonTitle alertViewClickIndexBlock:(DDAlertViewHUDClickIndexBlock)alertViewClickBlock; 43 | 44 | /** 45 | * 显示showDHAlertViewHUD 46 | */ 47 | - (void)showDHAlertViewHUD; 48 | @end 49 | -------------------------------------------------------------------------------- /DHAlertViewHUD/DHAlertViewHUD/DHAlertViewHUD.m: -------------------------------------------------------------------------------- 1 | // 2 | // DHAlertViewHUD.m 3 | // DHAlertViewHUD 4 | // 5 | // Created by Apple on 16/7/19. 6 | // Copyright © 2016年 dingding3w. All rights reserved. 7 | // 8 | 9 | #import "DHAlertViewHUD.h" 10 | #import "UILabel+DHExtension.h" 11 | #import "UIImage+DHExtension.h" 12 | 13 | #define DDScreenW [UIScreen mainScreen].bounds.size.width 14 | #define DDScreenH [UIScreen mainScreen].bounds.size.height 15 | 16 | #define DDAlertViewW 270.0 17 | #define DDAlertViewTitleH 20.0 18 | #define DDAlertViewButtonH 36.0 19 | #define DDTitleTopSpace 10.0 /**< 标题距离顶部的距离 */ 20 | #define DDMessageLabelSpace 20.0 21 | #define DDMessageLabelMAXH 400.0 22 | #define DDButtonLeftSpace 20.0 23 | 24 | #define DDQBlueColor [UIColor colorWithRed:9/255.0 green:170/255.0 blue:238/255.0 alpha:1.0] 25 | #define DDRedColor [UIColor colorWithRed:255/255.0 green:92/255.0 blue:79/255.0 alpha:1.0] 26 | #define DDLightGrayColor [UIColor colorWithRed:200/255.0 green:200/255.0 blue:200/255.0 alpha:1.0] 27 | 28 | #define DDTitleFont [UIFont boldSystemFontOfSize:17.0]; 29 | #define DDMessageFont [UIFont systemFontOfSize:14.0]; 30 | #define DDBtnTitleFont [UIFont systemFontOfSize:15.0]; 31 | 32 | @interface DHAlertViewHUD () 33 | @property (nonatomic, strong) UIWindow *alertWindow; 34 | @property (nonatomic, strong) UIView *alertView; 35 | @property (nonatomic, strong) UILabel *titleLabel; 36 | @property (nonatomic, strong) UILabel *messageLabel; 37 | @property (nonatomic, strong) UIButton *cancelButton; 38 | @property (nonatomic, strong) UIButton *otherButton; 39 | @property (nonatomic, assign) NSInteger buttonTitleID; 40 | @end 41 | 42 | @implementation DHAlertViewHUD 43 | - (instancetype)initWithTitle:(NSString *)title message:(NSString *)message cancelButtonTitle:(NSString *)cancelButtonTitle otherButtonTitle:(NSString *)otherButtonTitle alertViewClickIndexBlock:(DDAlertViewHUDClickIndexBlock)alertViewClickBlock { 44 | if (self = [super init]) { 45 | [self setFrame:[[UIScreen mainScreen] bounds]]; 46 | [self setBackgroundColor:[UIColor colorWithWhite:0.3 alpha:0.7]]; 47 | 48 | self.alertView = [[UIView alloc] init]; 49 | self.alertView.backgroundColor = [UIColor whiteColor]; 50 | self.alertView.layer.cornerRadius = 6.0; 51 | self.alertView.layer.masksToBounds = YES; 52 | self.alertView.userInteractionEnabled = YES; 53 | 54 | if (title) { 55 | self.titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, DDTitleTopSpace, DDAlertViewW, DDAlertViewTitleH)]; 56 | self.titleLabel.text = title; 57 | self.titleLabel.textAlignment = NSTextAlignmentCenter; 58 | self.titleLabel.textColor = [UIColor blackColor]; 59 | self.titleLabel.font = DDTitleFont; 60 | self.titleLabel.lineBreakMode = NSLineBreakByTruncatingTail;/**< 结尾部分的内容以……方式省略,显示头的文字内容*/ 61 | } 62 | 63 | self.messageLabel = [[UILabel alloc] init]; 64 | self.messageLabel.backgroundColor = [UIColor whiteColor]; 65 | self.messageLabel.text = message; 66 | self.messageLabel.textColor = [UIColor lightGrayColor]; 67 | self.messageLabel.font = DDMessageFont; 68 | self.messageLabel.numberOfLines = 0; 69 | self.messageLabel.textAlignment = NSTextAlignmentCenter; 70 | self.messageLabel.lineBreakMode = NSLineBreakByTruncatingTail;/**< 结尾部分的内容以……方式省略,显示头的文字内容*/ 71 | self.messageLabel.characterSpace = 2; /**< 字间距 */ 72 | self.messageLabel.lineSpace = 3; /**< 行间距 */ 73 | CGSize labelSize = [self.messageLabel getLableRectWithMaxWidth:DDAlertViewW - DDMessageLabelSpace*2]; 74 | CGFloat messageLabelAotuH = labelSize.height > DDMessageLabelMAXH ? DDMessageLabelMAXH : labelSize.height; 75 | self.messageLabel.frame = CGRectMake(DDMessageLabelSpace, CGRectGetMaxY(self.titleLabel.frame)+DDTitleTopSpace, DDAlertViewW-DDMessageLabelSpace*2, messageLabelAotuH); 76 | 77 | //计算alertView的高度(通过判断AlertView上显示的子视图来判断) 78 | if ((cancelButtonTitle.length>0 || otherButtonTitle.length>0) && title.length>0) { 79 | self.alertView.frame = CGRectMake(0, 0, DDAlertViewW, CGRectGetMaxY(self.messageLabel.frame)+DDAlertViewTitleH+DDAlertViewButtonH+DDTitleTopSpace); 80 | } else if ((cancelButtonTitle.length==0 || otherButtonTitle.length==0) && title.length>0) { 81 | self.alertView.frame=CGRectMake(0, 0, DDAlertViewW, CGRectGetMaxY(self.messageLabel.frame)+DDAlertViewTitleH+DDTitleTopSpace); 82 | } else if ((cancelButtonTitle.length==0 || otherButtonTitle.length==0) && title.length==0) { 83 | self.alertView.frame=CGRectMake(0, 0, DDAlertViewW, CGRectGetMaxY(self.messageLabel.frame)+DDTitleTopSpace); 84 | } 85 | 86 | 87 | self.alertView.center = self.center; 88 | [self addSubview:self.alertView]; 89 | [self.alertView addSubview:self.titleLabel]; 90 | [self.alertView addSubview:self.messageLabel]; 91 | 92 | if (cancelButtonTitle) { 93 | self.cancelButton = [UIButton buttonWithType:UIButtonTypeCustom]; 94 | self.cancelButton.titleLabel.font = DDBtnTitleFont; 95 | self.cancelButton.layer.cornerRadius = 3; 96 | self.cancelButton.layer.masksToBounds = YES; 97 | [self.cancelButton setTitle:cancelButtonTitle forState:UIControlStateNormal]; 98 | [self.cancelButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; 99 | [self.cancelButton setBackgroundImage:[UIImage imageWithColor:DDLightGrayColor] forState:UIControlStateNormal]; 100 | [self.cancelButton addTarget:self action:@selector(buttonClick:) forControlEvents:UIControlEventTouchUpInside]; 101 | [self.alertView addSubview:self.cancelButton]; 102 | } 103 | 104 | if (otherButtonTitle) { 105 | self.otherButton=[UIButton buttonWithType:UIButtonTypeCustom]; 106 | self.otherButton.titleLabel.font = DDBtnTitleFont; 107 | self.otherButton.layer.cornerRadius = 3; 108 | self.otherButton.layer.masksToBounds = YES; 109 | [self.otherButton setTitle:otherButtonTitle forState:UIControlStateNormal]; 110 | [self.otherButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; 111 | [self.otherButton setBackgroundImage:[UIImage imageWithColor:DDRedColor] forState:UIControlStateNormal]; 112 | [self.otherButton addTarget:self action:@selector(buttonClick:) forControlEvents:UIControlEventTouchUpInside]; 113 | [self.alertView addSubview:self.otherButton]; 114 | } 115 | 116 | self.buttonTitleID = 0; 117 | CGFloat buttonY = self.alertView.frame.size.height-DDAlertViewButtonH-10; 118 | if (cancelButtonTitle && !otherButtonTitle) { 119 | self.buttonTitleID = 1; 120 | self.cancelButton.tag = 0; 121 | self.cancelButton.frame = CGRectMake(DDButtonLeftSpace, buttonY, DDAlertViewW-DDButtonLeftSpace*2, DDAlertViewButtonH); 122 | } else if (!cancelButtonTitle && otherButtonTitle){ 123 | self.buttonTitleID = 2; 124 | self.otherButton.tag = 0; 125 | self.otherButton.frame = CGRectMake(DDButtonLeftSpace, buttonY, DDAlertViewW-DDButtonLeftSpace*2, DDAlertViewButtonH); 126 | } else if (cancelButtonTitle && otherButtonTitle){ 127 | self.buttonTitleID = 3; 128 | self.cancelButton.tag = 0; 129 | self.otherButton.tag = 1; 130 | CGFloat btnSpace = 20; /**< 两个button之间的间距 */ 131 | CGFloat buttonW = (DDAlertViewW-DDButtonLeftSpace*2-btnSpace)/2; 132 | self.cancelButton.frame = CGRectMake(DDButtonLeftSpace, buttonY, buttonW, DDAlertViewButtonH); 133 | self.otherButton.frame = CGRectMake(self.alertView.frame.size.width-buttonW-DDButtonLeftSpace, buttonY, buttonW, DDAlertViewButtonH); 134 | } else if (!cancelButtonTitle && !otherButtonTitle) { 135 | self.buttonTitleID = 4; 136 | dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ 137 | [self dismissDHAlertViewHUD]; 138 | }); 139 | } 140 | self.alertViewClickBlock = alertViewClickBlock; 141 | } 142 | return self; 143 | } 144 | 145 | - (void)buttonClick:(UIButton *)button { 146 | if (self.alertViewClickBlock) { 147 | self.alertViewClickBlock(button.tag); 148 | } 149 | [self dismissDHAlertViewHUD]; 150 | } 151 | 152 | - (void)showDHAlertViewHUD { 153 | self.alertWindow = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; 154 | self.alertWindow.windowLevel = UIWindowLevelAlert; 155 | [self.alertWindow becomeKeyWindow]; 156 | [self.alertWindow makeKeyAndVisible]; 157 | 158 | switch (self.alertViewButtonStyle) { 159 | case DDAlertViewButtonStyleInline: { 160 | 161 | } 162 | break; 163 | 164 | case DDAlertViewButtonStylePlain: { 165 | CGFloat buttonY = self.alertView.frame.size.height-DDAlertViewButtonH-5; 166 | if (self.buttonTitleID == 1) { 167 | self.cancelButton.layer.cornerRadius = 0.0; 168 | self.cancelButton.layer.masksToBounds = YES; 169 | self.cancelButton.frame = CGRectMake(0, buttonY, DDAlertViewW, DDAlertViewButtonH+5); 170 | } 171 | 172 | if (self.buttonTitleID == 2) { 173 | self.otherButton.layer.cornerRadius = 0.0; 174 | self.otherButton.layer.masksToBounds = YES; 175 | self.otherButton.frame = CGRectMake(0, buttonY, DDAlertViewW, DDAlertViewButtonH+5); 176 | } 177 | 178 | if (self.buttonTitleID == 3) { 179 | self.cancelButton.layer.cornerRadius = 0.0; 180 | self.cancelButton.layer.masksToBounds = YES; 181 | self.cancelButton.frame = CGRectMake(0, buttonY, DDAlertViewW*0.5, DDAlertViewButtonH+5); 182 | 183 | self.otherButton.layer.cornerRadius = 0.0; 184 | self.otherButton.layer.masksToBounds = YES; 185 | self.otherButton.frame = CGRectMake(DDAlertViewW*0.5, buttonY, DDAlertViewW*0.5, DDAlertViewButtonH+5); 186 | } 187 | } 188 | break; 189 | 190 | default: 191 | break; 192 | } 193 | 194 | [self.alertWindow addSubview:self]; 195 | [self setShowAnimation]; 196 | } 197 | 198 | - (void)dismissDHAlertViewHUD { 199 | [self removeFromSuperview]; 200 | [self.alertWindow resignKeyWindow]; 201 | } 202 | 203 | - (void)setAnimationStyle:(DDShowAlertViewAnimationStyle)animationStyle { 204 | self.alertViewAnimationStyle = animationStyle; 205 | } 206 | 207 | - (void)setShowAnimation { 208 | switch (self.alertViewAnimationStyle) { 209 | case DDShowAlertViewAnimationStyleDefault: { 210 | [UIView animateWithDuration:0 delay:0 options:UIViewAnimationOptionCurveEaseInOut animations:^{ 211 | [self.alertView.layer setValue:@(0) forKeyPath:@"transform.scale"]; 212 | } completion:^(BOOL finished) { 213 | [UIView animateWithDuration:0.23 delay:0 options:UIViewAnimationOptionCurveEaseInOut animations:^{ 214 | [self.alertView.layer setValue:@(1.2) forKeyPath:@"transform.scale"]; 215 | } completion:^(BOOL finished) { 216 | [UIView animateWithDuration:0.09 delay:0.02 options:UIViewAnimationOptionCurveEaseInOut animations:^{ 217 | [self.alertView.layer setValue:@(.9) forKeyPath:@"transform.scale"]; 218 | } completion:^(BOOL finished) { 219 | [UIView animateWithDuration:0.05 delay:0.02 options:UIViewAnimationOptionCurveEaseInOut animations:^{ 220 | [self.alertView.layer setValue:@(1.0) forKeyPath:@"transform.scale"]; 221 | } completion:^(BOOL finished) { 222 | 223 | }]; 224 | }]; 225 | }]; 226 | }]; 227 | } 228 | break; 229 | 230 | case DDShowAlertViewAnimationStyleTop: { 231 | CGPoint startPoint = CGPointMake(self.center.x, -self.alertView.frame.size.height); 232 | self.alertView.layer.position = startPoint; 233 | 234 | // duration : 动画的持续时间 235 | // delay : 动画执行的延迟时间 236 | // damping : 类似弹簧振动效果 0~1 (接近于0弹性效果越明显) 237 | // velocity : 初始速度 238 | // options : 动画过渡效果 239 | [UIView animateWithDuration:0.8 delay:0 usingSpringWithDamping:0.5 initialSpringVelocity:1.0 options:UIViewAnimationOptionCurveEaseIn animations:^{ 240 | self.alertView.layer.position = self.center; 241 | } completion:^(BOOL finished) { 242 | 243 | }]; 244 | } 245 | break; 246 | 247 | case DDShowAlertViewAnimationStyleLeft:{ 248 | CGPoint startPoint = CGPointMake(-DDAlertViewW, self.center.y); 249 | self.alertView.layer.position = startPoint; 250 | [UIView animateWithDuration:0.8 delay:0 usingSpringWithDamping:0.5 initialSpringVelocity:1.0 options:UIViewAnimationOptionCurveEaseIn animations:^{ 251 | self.alertView.layer.position = self.center; 252 | } completion:^(BOOL finished) { 253 | 254 | }]; 255 | } 256 | break; 257 | 258 | case DDShowAlertViewAnimationStyleBottom:{ 259 | CGPoint startPoint = CGPointMake(self.center.x, self.frame.size.height); 260 | self.alertView.layer.position = startPoint; 261 | [UIView animateWithDuration:0.8 delay:0 usingSpringWithDamping:0.5 initialSpringVelocity:1.0 options:UIViewAnimationOptionCurveEaseIn animations:^{ 262 | self.alertView.layer.position = self.center; 263 | } completion:^(BOOL finished) { 264 | 265 | }]; 266 | } 267 | break; 268 | 269 | case DDShowAlertViewAnimationStyleRight:{ 270 | CGPoint startPoint = CGPointMake(DDAlertViewW+DDAlertViewW, self.center.y); 271 | self.alertView.layer.position = startPoint; 272 | 273 | [UIView animateWithDuration:0.8 delay:0 usingSpringWithDamping:0.5 initialSpringVelocity:1.0 options:UIViewAnimationOptionCurveEaseIn animations:^{ 274 | self.alertView.layer.position = self.center; 275 | } completion:^(BOOL finished) { 276 | 277 | }]; 278 | } 279 | break; 280 | 281 | case DDShowAlertViewAnimationStyleNO:{ 282 | } 283 | break; 284 | 285 | default: 286 | break; 287 | } 288 | } 289 | @end 290 | -------------------------------------------------------------------------------- /DHAlertViewHUD/DHAlertViewHUD/UIImage+DHExtension.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIImage+DHExtension.h 3 | // DHAlertViewHUD 4 | // 5 | // Created by Apple on 16/7/19. 6 | // Copyright © 2016年 dingding3w. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface UIImage (DHExtension) 12 | + (UIImage *)imageWithColor:(UIColor *)color; 13 | @end 14 | -------------------------------------------------------------------------------- /DHAlertViewHUD/DHAlertViewHUD/UIImage+DHExtension.m: -------------------------------------------------------------------------------- 1 | // 2 | // UIImage+DHExtension.m 3 | // DHAlertViewHUD 4 | // 5 | // Created by Apple on 16/7/19. 6 | // Copyright © 2016年 dingding3w. All rights reserved. 7 | // 8 | 9 | #import "UIImage+DHExtension.h" 10 | 11 | @implementation UIImage (DHExtension) 12 | + (UIImage *)imageWithColor:(UIColor *)color { 13 | CGRect rect = CGRectMake(0.0f, 0.0f, 1.0f, 1.0f); 14 | UIGraphicsBeginImageContext(rect.size); 15 | CGContextRef context = UIGraphicsGetCurrentContext(); 16 | 17 | CGContextSetFillColorWithColor(context, [color CGColor]); 18 | CGContextFillRect(context, rect); 19 | 20 | UIImage *image = UIGraphicsGetImageFromCurrentImageContext(); 21 | UIGraphicsEndImageContext(); 22 | 23 | return image; 24 | } 25 | @end 26 | /** 27 | * 自定义视图圆角方案: 28 | * UIView *customFilletView = [[UIView alloc] initWithFrame:CGRectMake(10, 10, 200, 80)]; 29 | * [customFilletView setBackgroundColor:[UIColor redColor]]; 30 | * [self.view addSubview:customFilletView]; 31 | * 32 | * UIBezierPath *maskPath = [UIBezierPath bezierPathWithRoundedRect:customFilletView.bounds byRoundingCorners:UIRectCornerBottomLeft | UIRectCornerBottomRight cornerRadii:CGSizeMake(10, 10)]; 33 | * CAShapeLayer *maskLayer = [[CAShapeLayer alloc] init]; 34 | * maskLayer.frame = customFilletView.bounds; 35 | * maskLayer.path = maskPath.CGPath; 36 | * customFilletView.layer.mask = maskLayer; 37 | */ -------------------------------------------------------------------------------- /DHAlertViewHUD/DHAlertViewHUD/UILabel+DHExtension.h: -------------------------------------------------------------------------------- 1 | // 2 | // UILabel+DHExtension.h 3 | // DHAlertViewHUD 4 | // 5 | // Created by Apple on 16/7/19. 6 | // Copyright © 2016年 dingding3w. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface UILabel (DHExtension) 12 | /** 字间距 */ 13 | @property (nonatomic, assign) CGFloat characterSpace; 14 | /** 行间距 */ 15 | @property (nonatomic, assign) CGFloat lineSpace; 16 | /** 关键字 */ 17 | @property (nonatomic, copy ) NSString *keywords; 18 | @property (nonatomic, strong) UIFont *keywordsFont; 19 | @property (nonatomic, strong) UIColor *keywordsColor; 20 | 21 | /** 下划线 */ 22 | @property (nonatomic, copy ) NSString *underlineStr; 23 | @property (nonatomic, strong) UIColor *underlineColor; 24 | 25 | /** 26 | * 计算label宽高,必须调用 27 | * 28 | * @param maxWidth 最大宽度 29 | * 30 | * @return label的rect 31 | */ 32 | - (CGSize)getLableRectWithMaxWidth:(CGFloat)maxWidth; 33 | @end 34 | -------------------------------------------------------------------------------- /DHAlertViewHUD/DHAlertViewHUD/UILabel+DHExtension.m: -------------------------------------------------------------------------------- 1 | // 2 | // UILabel+DHExtension.m 3 | // DHAlertViewHUD 4 | // 5 | // Created by Apple on 16/7/19. 6 | // Copyright © 2016年 dingding3w. All rights reserved. 7 | // 8 | 9 | #import "UILabel+DHExtension.h" 10 | #import 11 | #import 12 | 13 | @implementation UILabel (DHExtension) 14 | -(CGFloat)characterSpace{ 15 | return [objc_getAssociatedObject(self,_cmd) floatValue]; 16 | } 17 | 18 | -(void)setCharacterSpace:(CGFloat)characterSpace{ 19 | objc_setAssociatedObject(self, @selector(characterSpace), @(characterSpace), OBJC_ASSOCIATION_RETAIN_NONATOMIC); 20 | } 21 | 22 | -(CGFloat)lineSpace{ 23 | return [objc_getAssociatedObject(self, _cmd) floatValue]; 24 | } 25 | 26 | -(void)setLineSpace:(CGFloat)lineSpace{ 27 | objc_setAssociatedObject(self, @selector(lineSpace), @(lineSpace), OBJC_ASSOCIATION_RETAIN_NONATOMIC); 28 | } 29 | 30 | 31 | -(NSString *)keywords{ 32 | return objc_getAssociatedObject(self, _cmd); 33 | } 34 | 35 | -(void)setKeywords:(NSString *)keywords{ 36 | objc_setAssociatedObject(self, @selector(keywords), keywords, OBJC_ASSOCIATION_RETAIN_NONATOMIC); 37 | } 38 | 39 | -(UIFont *)keywordsFont{ 40 | return objc_getAssociatedObject(self, _cmd); 41 | } 42 | 43 | -(void)setKeywordsFont:(UIFont *)keywordsFont{ 44 | objc_setAssociatedObject(self, @selector(keywordsFont), keywordsFont, OBJC_ASSOCIATION_RETAIN_NONATOMIC); 45 | } 46 | 47 | -(UIColor *)keywordsColor{ 48 | return objc_getAssociatedObject(self, _cmd); 49 | } 50 | 51 | -(void)setKeywordsColor:(UIColor *)keywordsColor{ 52 | objc_setAssociatedObject(self, @selector(keywordsColor), keywordsColor, OBJC_ASSOCIATION_RETAIN_NONATOMIC); 53 | } 54 | 55 | -(NSString *)underlineStr{ 56 | return objc_getAssociatedObject(self, _cmd); 57 | } 58 | 59 | -(void)setUnderlineStr:(NSString *)underlineStr{ 60 | objc_setAssociatedObject(self, @selector(underlineStr), underlineStr, OBJC_ASSOCIATION_RETAIN_NONATOMIC); 61 | 62 | } 63 | 64 | -(UIColor *)underlineColor{ 65 | return objc_getAssociatedObject(self, _cmd); 66 | } 67 | 68 | -(void)setUnderlineColor:(UIColor *)underlineColor{ 69 | objc_setAssociatedObject(self, @selector(underlineColor), underlineColor, OBJC_ASSOCIATION_RETAIN_NONATOMIC); 70 | } 71 | 72 | /** 73 | * 根据最大宽度计算label宽,高 74 | * 75 | * @param maxWidth 最大宽度 76 | * 77 | * @return rect 78 | */ 79 | - (CGSize)getLableRectWithMaxWidth:(CGFloat)maxWidth{ 80 | 81 | NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc]initWithString:self.text]; 82 | [attributedString addAttribute:NSFontAttributeName value:self.font range:NSMakeRange(0,self.text.length)]; 83 | 84 | NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc]init]; 85 | // paragraphStyle.alignment=NSTextAlignmentCenter; 86 | paragraphStyle.alignment=self.textAlignment; 87 | paragraphStyle.lineBreakMode=self.lineBreakMode; 88 | /**< 行间距 */ 89 | if(self.lineSpace > 0){ 90 | [paragraphStyle setLineSpacing:self.lineSpace]; 91 | [attributedString addAttribute:NSParagraphStyleAttributeName value:paragraphStyle range:NSMakeRange(0,self.text.length)]; 92 | } 93 | 94 | /**< 字间距 */ 95 | if(self.characterSpace > 0){ 96 | long number = self.characterSpace; 97 | CFNumberRef num = CFNumberCreate(kCFAllocatorDefault,kCFNumberSInt8Type,&number); 98 | [attributedString addAttribute:(id)kCTKernAttributeName value:(__bridge id)num range:NSMakeRange(0,[attributedString length])]; 99 | 100 | CFRelease(num); 101 | } 102 | 103 | /**< 关键字 */ 104 | if (self.keywords) { 105 | NSRange itemRange = [self.text rangeOfString:self.keywords]; 106 | if (self.keywordsFont) { 107 | [attributedString addAttribute:NSFontAttributeName value:self.keywordsFont range:itemRange]; 108 | 109 | } 110 | 111 | if (self.keywordsColor) { 112 | [attributedString addAttribute:NSForegroundColorAttributeName value:self.keywordsColor range:itemRange]; 113 | 114 | } 115 | } 116 | 117 | /**< 下划线 */ 118 | if (self.underlineStr) { 119 | NSRange itemRange = [self.text rangeOfString:self.underlineStr]; 120 | [attributedString addAttribute:NSUnderlineStyleAttributeName value:@(NSUnderlineStyleSingle) range:itemRange]; 121 | if (self.underlineColor) { 122 | [attributedString addAttribute:NSUnderlineColorAttributeName value:self.underlineColor range:itemRange]; 123 | } 124 | } 125 | 126 | self.attributedText = attributedString; 127 | /**< 计算 */ 128 | CGSize maximumLabelSize = CGSizeMake(maxWidth, MAXFLOAT);//labelsize的最大值 129 | CGSize expectSize = [self sizeThatFits:maximumLabelSize]; 130 | return expectSize; 131 | } 132 | @end 133 | -------------------------------------------------------------------------------- /DHAlertViewHUD/DHAlertViewHUDExample/DHAlertViewHUDExample.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 18D6247F1D3E21CE00B763F8 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 18D6247E1D3E21CE00B763F8 /* main.m */; }; 11 | 18D624881D3E21CE00B763F8 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 18D624861D3E21CE00B763F8 /* Main.storyboard */; }; 12 | 18D6248A1D3E21CE00B763F8 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 18D624891D3E21CE00B763F8 /* Assets.xcassets */; }; 13 | 18D6248D1D3E21CE00B763F8 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 18D6248B1D3E21CE00B763F8 /* LaunchScreen.storyboard */; }; 14 | 18D624981D3E21CE00B763F8 /* DHAlertViewHUDExampleTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 18D624971D3E21CE00B763F8 /* DHAlertViewHUDExampleTests.m */; }; 15 | 18D624A31D3E21CE00B763F8 /* DHAlertViewHUDExampleUITests.m in Sources */ = {isa = PBXBuildFile; fileRef = 18D624A21D3E21CE00B763F8 /* DHAlertViewHUDExampleUITests.m */; }; 16 | 18D624B71D3E228B00B763F8 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 18D624B31D3E228B00B763F8 /* AppDelegate.m */; }; 17 | 18D624B81D3E228B00B763F8 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 18D624B61D3E228B00B763F8 /* ViewController.m */; }; 18 | 18D624C01D3E229C00B763F8 /* DHAlertViewHUD.m in Sources */ = {isa = PBXBuildFile; fileRef = 18D624BB1D3E229C00B763F8 /* DHAlertViewHUD.m */; }; 19 | 18D624C11D3E229C00B763F8 /* UIImage+DHExtension.m in Sources */ = {isa = PBXBuildFile; fileRef = 18D624BD1D3E229C00B763F8 /* UIImage+DHExtension.m */; }; 20 | 18D624C21D3E229C00B763F8 /* UILabel+DHExtension.m in Sources */ = {isa = PBXBuildFile; fileRef = 18D624BF1D3E229C00B763F8 /* UILabel+DHExtension.m */; }; 21 | /* End PBXBuildFile section */ 22 | 23 | /* Begin PBXContainerItemProxy section */ 24 | 18D624941D3E21CE00B763F8 /* PBXContainerItemProxy */ = { 25 | isa = PBXContainerItemProxy; 26 | containerPortal = 18D624721D3E21CE00B763F8 /* Project object */; 27 | proxyType = 1; 28 | remoteGlobalIDString = 18D624791D3E21CE00B763F8; 29 | remoteInfo = DHAlertViewHUDExample; 30 | }; 31 | 18D6249F1D3E21CE00B763F8 /* PBXContainerItemProxy */ = { 32 | isa = PBXContainerItemProxy; 33 | containerPortal = 18D624721D3E21CE00B763F8 /* Project object */; 34 | proxyType = 1; 35 | remoteGlobalIDString = 18D624791D3E21CE00B763F8; 36 | remoteInfo = DHAlertViewHUDExample; 37 | }; 38 | /* End PBXContainerItemProxy section */ 39 | 40 | /* Begin PBXFileReference section */ 41 | 18D6247A1D3E21CE00B763F8 /* DHAlertViewHUDExample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = DHAlertViewHUDExample.app; sourceTree = BUILT_PRODUCTS_DIR; }; 42 | 18D6247E1D3E21CE00B763F8 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 43 | 18D624871D3E21CE00B763F8 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 44 | 18D624891D3E21CE00B763F8 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 45 | 18D6248C1D3E21CE00B763F8 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 46 | 18D6248E1D3E21CE00B763F8 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 47 | 18D624931D3E21CE00B763F8 /* DHAlertViewHUDExampleTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = DHAlertViewHUDExampleTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 48 | 18D624971D3E21CE00B763F8 /* DHAlertViewHUDExampleTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = DHAlertViewHUDExampleTests.m; sourceTree = ""; }; 49 | 18D624991D3E21CE00B763F8 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 50 | 18D6249E1D3E21CE00B763F8 /* DHAlertViewHUDExampleUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = DHAlertViewHUDExampleUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 51 | 18D624A21D3E21CE00B763F8 /* DHAlertViewHUDExampleUITests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = DHAlertViewHUDExampleUITests.m; sourceTree = ""; }; 52 | 18D624A41D3E21CE00B763F8 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 53 | 18D624B21D3E228B00B763F8 /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 54 | 18D624B31D3E228B00B763F8 /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 55 | 18D624B51D3E228B00B763F8 /* ViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; 56 | 18D624B61D3E228B00B763F8 /* ViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; 57 | 18D624BA1D3E229C00B763F8 /* DHAlertViewHUD.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DHAlertViewHUD.h; sourceTree = ""; }; 58 | 18D624BB1D3E229C00B763F8 /* DHAlertViewHUD.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DHAlertViewHUD.m; sourceTree = ""; }; 59 | 18D624BC1D3E229C00B763F8 /* UIImage+DHExtension.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIImage+DHExtension.h"; sourceTree = ""; }; 60 | 18D624BD1D3E229C00B763F8 /* UIImage+DHExtension.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIImage+DHExtension.m"; sourceTree = ""; }; 61 | 18D624BE1D3E229C00B763F8 /* UILabel+DHExtension.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UILabel+DHExtension.h"; sourceTree = ""; }; 62 | 18D624BF1D3E229C00B763F8 /* UILabel+DHExtension.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UILabel+DHExtension.m"; sourceTree = ""; }; 63 | /* End PBXFileReference section */ 64 | 65 | /* Begin PBXFrameworksBuildPhase section */ 66 | 18D624771D3E21CE00B763F8 /* Frameworks */ = { 67 | isa = PBXFrameworksBuildPhase; 68 | buildActionMask = 2147483647; 69 | files = ( 70 | ); 71 | runOnlyForDeploymentPostprocessing = 0; 72 | }; 73 | 18D624901D3E21CE00B763F8 /* Frameworks */ = { 74 | isa = PBXFrameworksBuildPhase; 75 | buildActionMask = 2147483647; 76 | files = ( 77 | ); 78 | runOnlyForDeploymentPostprocessing = 0; 79 | }; 80 | 18D6249B1D3E21CE00B763F8 /* Frameworks */ = { 81 | isa = PBXFrameworksBuildPhase; 82 | buildActionMask = 2147483647; 83 | files = ( 84 | ); 85 | runOnlyForDeploymentPostprocessing = 0; 86 | }; 87 | /* End PBXFrameworksBuildPhase section */ 88 | 89 | /* Begin PBXGroup section */ 90 | 18D624711D3E21CE00B763F8 = { 91 | isa = PBXGroup; 92 | children = ( 93 | 18D6247C1D3E21CE00B763F8 /* DHAlertViewHUDExample */, 94 | 18D624961D3E21CE00B763F8 /* DHAlertViewHUDExampleTests */, 95 | 18D624A11D3E21CE00B763F8 /* DHAlertViewHUDExampleUITests */, 96 | 18D6247B1D3E21CE00B763F8 /* Products */, 97 | ); 98 | sourceTree = ""; 99 | }; 100 | 18D6247B1D3E21CE00B763F8 /* Products */ = { 101 | isa = PBXGroup; 102 | children = ( 103 | 18D6247A1D3E21CE00B763F8 /* DHAlertViewHUDExample.app */, 104 | 18D624931D3E21CE00B763F8 /* DHAlertViewHUDExampleTests.xctest */, 105 | 18D6249E1D3E21CE00B763F8 /* DHAlertViewHUDExampleUITests.xctest */, 106 | ); 107 | name = Products; 108 | sourceTree = ""; 109 | }; 110 | 18D6247C1D3E21CE00B763F8 /* DHAlertViewHUDExample */ = { 111 | isa = PBXGroup; 112 | children = ( 113 | 18D624B91D3E229C00B763F8 /* DHAlertViewHUD */, 114 | 18D624B01D3E228B00B763F8 /* Classes */, 115 | 18D6247D1D3E21CE00B763F8 /* Supporting Files */, 116 | ); 117 | path = DHAlertViewHUDExample; 118 | sourceTree = ""; 119 | }; 120 | 18D6247D1D3E21CE00B763F8 /* Supporting Files */ = { 121 | isa = PBXGroup; 122 | children = ( 123 | 18D624861D3E21CE00B763F8 /* Main.storyboard */, 124 | 18D624891D3E21CE00B763F8 /* Assets.xcassets */, 125 | 18D6248B1D3E21CE00B763F8 /* LaunchScreen.storyboard */, 126 | 18D6248E1D3E21CE00B763F8 /* Info.plist */, 127 | 18D6247E1D3E21CE00B763F8 /* main.m */, 128 | ); 129 | name = "Supporting Files"; 130 | sourceTree = ""; 131 | }; 132 | 18D624961D3E21CE00B763F8 /* DHAlertViewHUDExampleTests */ = { 133 | isa = PBXGroup; 134 | children = ( 135 | 18D624971D3E21CE00B763F8 /* DHAlertViewHUDExampleTests.m */, 136 | 18D624991D3E21CE00B763F8 /* Info.plist */, 137 | ); 138 | path = DHAlertViewHUDExampleTests; 139 | sourceTree = ""; 140 | }; 141 | 18D624A11D3E21CE00B763F8 /* DHAlertViewHUDExampleUITests */ = { 142 | isa = PBXGroup; 143 | children = ( 144 | 18D624A21D3E21CE00B763F8 /* DHAlertViewHUDExampleUITests.m */, 145 | 18D624A41D3E21CE00B763F8 /* Info.plist */, 146 | ); 147 | path = DHAlertViewHUDExampleUITests; 148 | sourceTree = ""; 149 | }; 150 | 18D624B01D3E228B00B763F8 /* Classes */ = { 151 | isa = PBXGroup; 152 | children = ( 153 | 18D624B11D3E228B00B763F8 /* AppDelegate */, 154 | 18D624B41D3E228B00B763F8 /* ViewController */, 155 | ); 156 | path = Classes; 157 | sourceTree = ""; 158 | }; 159 | 18D624B11D3E228B00B763F8 /* AppDelegate */ = { 160 | isa = PBXGroup; 161 | children = ( 162 | 18D624B21D3E228B00B763F8 /* AppDelegate.h */, 163 | 18D624B31D3E228B00B763F8 /* AppDelegate.m */, 164 | ); 165 | path = AppDelegate; 166 | sourceTree = ""; 167 | }; 168 | 18D624B41D3E228B00B763F8 /* ViewController */ = { 169 | isa = PBXGroup; 170 | children = ( 171 | 18D624B51D3E228B00B763F8 /* ViewController.h */, 172 | 18D624B61D3E228B00B763F8 /* ViewController.m */, 173 | ); 174 | path = ViewController; 175 | sourceTree = ""; 176 | }; 177 | 18D624B91D3E229C00B763F8 /* DHAlertViewHUD */ = { 178 | isa = PBXGroup; 179 | children = ( 180 | 18D624BA1D3E229C00B763F8 /* DHAlertViewHUD.h */, 181 | 18D624BB1D3E229C00B763F8 /* DHAlertViewHUD.m */, 182 | 18D624BC1D3E229C00B763F8 /* UIImage+DHExtension.h */, 183 | 18D624BD1D3E229C00B763F8 /* UIImage+DHExtension.m */, 184 | 18D624BE1D3E229C00B763F8 /* UILabel+DHExtension.h */, 185 | 18D624BF1D3E229C00B763F8 /* UILabel+DHExtension.m */, 186 | ); 187 | name = DHAlertViewHUD; 188 | path = ../../DHAlertViewHUD; 189 | sourceTree = ""; 190 | }; 191 | /* End PBXGroup section */ 192 | 193 | /* Begin PBXNativeTarget section */ 194 | 18D624791D3E21CE00B763F8 /* DHAlertViewHUDExample */ = { 195 | isa = PBXNativeTarget; 196 | buildConfigurationList = 18D624A71D3E21CE00B763F8 /* Build configuration list for PBXNativeTarget "DHAlertViewHUDExample" */; 197 | buildPhases = ( 198 | 18D624761D3E21CE00B763F8 /* Sources */, 199 | 18D624771D3E21CE00B763F8 /* Frameworks */, 200 | 18D624781D3E21CE00B763F8 /* Resources */, 201 | ); 202 | buildRules = ( 203 | ); 204 | dependencies = ( 205 | ); 206 | name = DHAlertViewHUDExample; 207 | productName = DHAlertViewHUDExample; 208 | productReference = 18D6247A1D3E21CE00B763F8 /* DHAlertViewHUDExample.app */; 209 | productType = "com.apple.product-type.application"; 210 | }; 211 | 18D624921D3E21CE00B763F8 /* DHAlertViewHUDExampleTests */ = { 212 | isa = PBXNativeTarget; 213 | buildConfigurationList = 18D624AA1D3E21CE00B763F8 /* Build configuration list for PBXNativeTarget "DHAlertViewHUDExampleTests" */; 214 | buildPhases = ( 215 | 18D6248F1D3E21CE00B763F8 /* Sources */, 216 | 18D624901D3E21CE00B763F8 /* Frameworks */, 217 | 18D624911D3E21CE00B763F8 /* Resources */, 218 | ); 219 | buildRules = ( 220 | ); 221 | dependencies = ( 222 | 18D624951D3E21CE00B763F8 /* PBXTargetDependency */, 223 | ); 224 | name = DHAlertViewHUDExampleTests; 225 | productName = DHAlertViewHUDExampleTests; 226 | productReference = 18D624931D3E21CE00B763F8 /* DHAlertViewHUDExampleTests.xctest */; 227 | productType = "com.apple.product-type.bundle.unit-test"; 228 | }; 229 | 18D6249D1D3E21CE00B763F8 /* DHAlertViewHUDExampleUITests */ = { 230 | isa = PBXNativeTarget; 231 | buildConfigurationList = 18D624AD1D3E21CE00B763F8 /* Build configuration list for PBXNativeTarget "DHAlertViewHUDExampleUITests" */; 232 | buildPhases = ( 233 | 18D6249A1D3E21CE00B763F8 /* Sources */, 234 | 18D6249B1D3E21CE00B763F8 /* Frameworks */, 235 | 18D6249C1D3E21CE00B763F8 /* Resources */, 236 | ); 237 | buildRules = ( 238 | ); 239 | dependencies = ( 240 | 18D624A01D3E21CE00B763F8 /* PBXTargetDependency */, 241 | ); 242 | name = DHAlertViewHUDExampleUITests; 243 | productName = DHAlertViewHUDExampleUITests; 244 | productReference = 18D6249E1D3E21CE00B763F8 /* DHAlertViewHUDExampleUITests.xctest */; 245 | productType = "com.apple.product-type.bundle.ui-testing"; 246 | }; 247 | /* End PBXNativeTarget section */ 248 | 249 | /* Begin PBXProject section */ 250 | 18D624721D3E21CE00B763F8 /* Project object */ = { 251 | isa = PBXProject; 252 | attributes = { 253 | LastUpgradeCheck = 0720; 254 | ORGANIZATIONNAME = dingding3w; 255 | TargetAttributes = { 256 | 18D624791D3E21CE00B763F8 = { 257 | CreatedOnToolsVersion = 7.2; 258 | }; 259 | 18D624921D3E21CE00B763F8 = { 260 | CreatedOnToolsVersion = 7.2; 261 | TestTargetID = 18D624791D3E21CE00B763F8; 262 | }; 263 | 18D6249D1D3E21CE00B763F8 = { 264 | CreatedOnToolsVersion = 7.2; 265 | TestTargetID = 18D624791D3E21CE00B763F8; 266 | }; 267 | }; 268 | }; 269 | buildConfigurationList = 18D624751D3E21CE00B763F8 /* Build configuration list for PBXProject "DHAlertViewHUDExample" */; 270 | compatibilityVersion = "Xcode 3.2"; 271 | developmentRegion = English; 272 | hasScannedForEncodings = 0; 273 | knownRegions = ( 274 | en, 275 | Base, 276 | ); 277 | mainGroup = 18D624711D3E21CE00B763F8; 278 | productRefGroup = 18D6247B1D3E21CE00B763F8 /* Products */; 279 | projectDirPath = ""; 280 | projectRoot = ""; 281 | targets = ( 282 | 18D624791D3E21CE00B763F8 /* DHAlertViewHUDExample */, 283 | 18D624921D3E21CE00B763F8 /* DHAlertViewHUDExampleTests */, 284 | 18D6249D1D3E21CE00B763F8 /* DHAlertViewHUDExampleUITests */, 285 | ); 286 | }; 287 | /* End PBXProject section */ 288 | 289 | /* Begin PBXResourcesBuildPhase section */ 290 | 18D624781D3E21CE00B763F8 /* Resources */ = { 291 | isa = PBXResourcesBuildPhase; 292 | buildActionMask = 2147483647; 293 | files = ( 294 | 18D6248D1D3E21CE00B763F8 /* LaunchScreen.storyboard in Resources */, 295 | 18D6248A1D3E21CE00B763F8 /* Assets.xcassets in Resources */, 296 | 18D624881D3E21CE00B763F8 /* Main.storyboard in Resources */, 297 | ); 298 | runOnlyForDeploymentPostprocessing = 0; 299 | }; 300 | 18D624911D3E21CE00B763F8 /* Resources */ = { 301 | isa = PBXResourcesBuildPhase; 302 | buildActionMask = 2147483647; 303 | files = ( 304 | ); 305 | runOnlyForDeploymentPostprocessing = 0; 306 | }; 307 | 18D6249C1D3E21CE00B763F8 /* Resources */ = { 308 | isa = PBXResourcesBuildPhase; 309 | buildActionMask = 2147483647; 310 | files = ( 311 | ); 312 | runOnlyForDeploymentPostprocessing = 0; 313 | }; 314 | /* End PBXResourcesBuildPhase section */ 315 | 316 | /* Begin PBXSourcesBuildPhase section */ 317 | 18D624761D3E21CE00B763F8 /* Sources */ = { 318 | isa = PBXSourcesBuildPhase; 319 | buildActionMask = 2147483647; 320 | files = ( 321 | 18D624C21D3E229C00B763F8 /* UILabel+DHExtension.m in Sources */, 322 | 18D624B81D3E228B00B763F8 /* ViewController.m in Sources */, 323 | 18D624B71D3E228B00B763F8 /* AppDelegate.m in Sources */, 324 | 18D624C11D3E229C00B763F8 /* UIImage+DHExtension.m in Sources */, 325 | 18D6247F1D3E21CE00B763F8 /* main.m in Sources */, 326 | 18D624C01D3E229C00B763F8 /* DHAlertViewHUD.m in Sources */, 327 | ); 328 | runOnlyForDeploymentPostprocessing = 0; 329 | }; 330 | 18D6248F1D3E21CE00B763F8 /* Sources */ = { 331 | isa = PBXSourcesBuildPhase; 332 | buildActionMask = 2147483647; 333 | files = ( 334 | 18D624981D3E21CE00B763F8 /* DHAlertViewHUDExampleTests.m in Sources */, 335 | ); 336 | runOnlyForDeploymentPostprocessing = 0; 337 | }; 338 | 18D6249A1D3E21CE00B763F8 /* Sources */ = { 339 | isa = PBXSourcesBuildPhase; 340 | buildActionMask = 2147483647; 341 | files = ( 342 | 18D624A31D3E21CE00B763F8 /* DHAlertViewHUDExampleUITests.m in Sources */, 343 | ); 344 | runOnlyForDeploymentPostprocessing = 0; 345 | }; 346 | /* End PBXSourcesBuildPhase section */ 347 | 348 | /* Begin PBXTargetDependency section */ 349 | 18D624951D3E21CE00B763F8 /* PBXTargetDependency */ = { 350 | isa = PBXTargetDependency; 351 | target = 18D624791D3E21CE00B763F8 /* DHAlertViewHUDExample */; 352 | targetProxy = 18D624941D3E21CE00B763F8 /* PBXContainerItemProxy */; 353 | }; 354 | 18D624A01D3E21CE00B763F8 /* PBXTargetDependency */ = { 355 | isa = PBXTargetDependency; 356 | target = 18D624791D3E21CE00B763F8 /* DHAlertViewHUDExample */; 357 | targetProxy = 18D6249F1D3E21CE00B763F8 /* PBXContainerItemProxy */; 358 | }; 359 | /* End PBXTargetDependency section */ 360 | 361 | /* Begin PBXVariantGroup section */ 362 | 18D624861D3E21CE00B763F8 /* Main.storyboard */ = { 363 | isa = PBXVariantGroup; 364 | children = ( 365 | 18D624871D3E21CE00B763F8 /* Base */, 366 | ); 367 | name = Main.storyboard; 368 | sourceTree = ""; 369 | }; 370 | 18D6248B1D3E21CE00B763F8 /* LaunchScreen.storyboard */ = { 371 | isa = PBXVariantGroup; 372 | children = ( 373 | 18D6248C1D3E21CE00B763F8 /* Base */, 374 | ); 375 | name = LaunchScreen.storyboard; 376 | sourceTree = ""; 377 | }; 378 | /* End PBXVariantGroup section */ 379 | 380 | /* Begin XCBuildConfiguration section */ 381 | 18D624A51D3E21CE00B763F8 /* Debug */ = { 382 | isa = XCBuildConfiguration; 383 | buildSettings = { 384 | ALWAYS_SEARCH_USER_PATHS = NO; 385 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 386 | CLANG_CXX_LIBRARY = "libc++"; 387 | CLANG_ENABLE_MODULES = YES; 388 | CLANG_ENABLE_OBJC_ARC = YES; 389 | CLANG_WARN_BOOL_CONVERSION = YES; 390 | CLANG_WARN_CONSTANT_CONVERSION = YES; 391 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 392 | CLANG_WARN_EMPTY_BODY = YES; 393 | CLANG_WARN_ENUM_CONVERSION = YES; 394 | CLANG_WARN_INT_CONVERSION = YES; 395 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 396 | CLANG_WARN_UNREACHABLE_CODE = YES; 397 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 398 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 399 | COPY_PHASE_STRIP = NO; 400 | DEBUG_INFORMATION_FORMAT = dwarf; 401 | ENABLE_STRICT_OBJC_MSGSEND = YES; 402 | ENABLE_TESTABILITY = YES; 403 | GCC_C_LANGUAGE_STANDARD = gnu99; 404 | GCC_DYNAMIC_NO_PIC = NO; 405 | GCC_NO_COMMON_BLOCKS = YES; 406 | GCC_OPTIMIZATION_LEVEL = 0; 407 | GCC_PREPROCESSOR_DEFINITIONS = ( 408 | "DEBUG=1", 409 | "$(inherited)", 410 | ); 411 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 412 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 413 | GCC_WARN_UNDECLARED_SELECTOR = YES; 414 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 415 | GCC_WARN_UNUSED_FUNCTION = YES; 416 | GCC_WARN_UNUSED_VARIABLE = YES; 417 | IPHONEOS_DEPLOYMENT_TARGET = 9.2; 418 | MTL_ENABLE_DEBUG_INFO = YES; 419 | ONLY_ACTIVE_ARCH = YES; 420 | SDKROOT = iphoneos; 421 | }; 422 | name = Debug; 423 | }; 424 | 18D624A61D3E21CE00B763F8 /* Release */ = { 425 | isa = XCBuildConfiguration; 426 | buildSettings = { 427 | ALWAYS_SEARCH_USER_PATHS = NO; 428 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 429 | CLANG_CXX_LIBRARY = "libc++"; 430 | CLANG_ENABLE_MODULES = YES; 431 | CLANG_ENABLE_OBJC_ARC = YES; 432 | CLANG_WARN_BOOL_CONVERSION = YES; 433 | CLANG_WARN_CONSTANT_CONVERSION = YES; 434 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 435 | CLANG_WARN_EMPTY_BODY = YES; 436 | CLANG_WARN_ENUM_CONVERSION = YES; 437 | CLANG_WARN_INT_CONVERSION = YES; 438 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 439 | CLANG_WARN_UNREACHABLE_CODE = YES; 440 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 441 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 442 | COPY_PHASE_STRIP = NO; 443 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 444 | ENABLE_NS_ASSERTIONS = NO; 445 | ENABLE_STRICT_OBJC_MSGSEND = YES; 446 | GCC_C_LANGUAGE_STANDARD = gnu99; 447 | GCC_NO_COMMON_BLOCKS = YES; 448 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 449 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 450 | GCC_WARN_UNDECLARED_SELECTOR = YES; 451 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 452 | GCC_WARN_UNUSED_FUNCTION = YES; 453 | GCC_WARN_UNUSED_VARIABLE = YES; 454 | IPHONEOS_DEPLOYMENT_TARGET = 9.2; 455 | MTL_ENABLE_DEBUG_INFO = NO; 456 | SDKROOT = iphoneos; 457 | VALIDATE_PRODUCT = YES; 458 | }; 459 | name = Release; 460 | }; 461 | 18D624A81D3E21CE00B763F8 /* Debug */ = { 462 | isa = XCBuildConfiguration; 463 | buildSettings = { 464 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 465 | INFOPLIST_FILE = DHAlertViewHUDExample/Info.plist; 466 | IPHONEOS_DEPLOYMENT_TARGET = 9.0; 467 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 468 | PRODUCT_BUNDLE_IDENTIFIER = dingding3w.DHAlertViewHUDExample; 469 | PRODUCT_NAME = "$(TARGET_NAME)"; 470 | }; 471 | name = Debug; 472 | }; 473 | 18D624A91D3E21CE00B763F8 /* Release */ = { 474 | isa = XCBuildConfiguration; 475 | buildSettings = { 476 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 477 | INFOPLIST_FILE = DHAlertViewHUDExample/Info.plist; 478 | IPHONEOS_DEPLOYMENT_TARGET = 9.0; 479 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 480 | PRODUCT_BUNDLE_IDENTIFIER = dingding3w.DHAlertViewHUDExample; 481 | PRODUCT_NAME = "$(TARGET_NAME)"; 482 | }; 483 | name = Release; 484 | }; 485 | 18D624AB1D3E21CE00B763F8 /* Debug */ = { 486 | isa = XCBuildConfiguration; 487 | buildSettings = { 488 | BUNDLE_LOADER = "$(TEST_HOST)"; 489 | INFOPLIST_FILE = DHAlertViewHUDExampleTests/Info.plist; 490 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 491 | PRODUCT_BUNDLE_IDENTIFIER = dingding3w.DHAlertViewHUDExampleTests; 492 | PRODUCT_NAME = "$(TARGET_NAME)"; 493 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/DHAlertViewHUDExample.app/DHAlertViewHUDExample"; 494 | }; 495 | name = Debug; 496 | }; 497 | 18D624AC1D3E21CE00B763F8 /* Release */ = { 498 | isa = XCBuildConfiguration; 499 | buildSettings = { 500 | BUNDLE_LOADER = "$(TEST_HOST)"; 501 | INFOPLIST_FILE = DHAlertViewHUDExampleTests/Info.plist; 502 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 503 | PRODUCT_BUNDLE_IDENTIFIER = dingding3w.DHAlertViewHUDExampleTests; 504 | PRODUCT_NAME = "$(TARGET_NAME)"; 505 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/DHAlertViewHUDExample.app/DHAlertViewHUDExample"; 506 | }; 507 | name = Release; 508 | }; 509 | 18D624AE1D3E21CE00B763F8 /* Debug */ = { 510 | isa = XCBuildConfiguration; 511 | buildSettings = { 512 | INFOPLIST_FILE = DHAlertViewHUDExampleUITests/Info.plist; 513 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 514 | PRODUCT_BUNDLE_IDENTIFIER = dingding3w.DHAlertViewHUDExampleUITests; 515 | PRODUCT_NAME = "$(TARGET_NAME)"; 516 | TEST_TARGET_NAME = DHAlertViewHUDExample; 517 | USES_XCTRUNNER = YES; 518 | }; 519 | name = Debug; 520 | }; 521 | 18D624AF1D3E21CE00B763F8 /* Release */ = { 522 | isa = XCBuildConfiguration; 523 | buildSettings = { 524 | INFOPLIST_FILE = DHAlertViewHUDExampleUITests/Info.plist; 525 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 526 | PRODUCT_BUNDLE_IDENTIFIER = dingding3w.DHAlertViewHUDExampleUITests; 527 | PRODUCT_NAME = "$(TARGET_NAME)"; 528 | TEST_TARGET_NAME = DHAlertViewHUDExample; 529 | USES_XCTRUNNER = YES; 530 | }; 531 | name = Release; 532 | }; 533 | /* End XCBuildConfiguration section */ 534 | 535 | /* Begin XCConfigurationList section */ 536 | 18D624751D3E21CE00B763F8 /* Build configuration list for PBXProject "DHAlertViewHUDExample" */ = { 537 | isa = XCConfigurationList; 538 | buildConfigurations = ( 539 | 18D624A51D3E21CE00B763F8 /* Debug */, 540 | 18D624A61D3E21CE00B763F8 /* Release */, 541 | ); 542 | defaultConfigurationIsVisible = 0; 543 | defaultConfigurationName = Release; 544 | }; 545 | 18D624A71D3E21CE00B763F8 /* Build configuration list for PBXNativeTarget "DHAlertViewHUDExample" */ = { 546 | isa = XCConfigurationList; 547 | buildConfigurations = ( 548 | 18D624A81D3E21CE00B763F8 /* Debug */, 549 | 18D624A91D3E21CE00B763F8 /* Release */, 550 | ); 551 | defaultConfigurationIsVisible = 0; 552 | }; 553 | 18D624AA1D3E21CE00B763F8 /* Build configuration list for PBXNativeTarget "DHAlertViewHUDExampleTests" */ = { 554 | isa = XCConfigurationList; 555 | buildConfigurations = ( 556 | 18D624AB1D3E21CE00B763F8 /* Debug */, 557 | 18D624AC1D3E21CE00B763F8 /* Release */, 558 | ); 559 | defaultConfigurationIsVisible = 0; 560 | }; 561 | 18D624AD1D3E21CE00B763F8 /* Build configuration list for PBXNativeTarget "DHAlertViewHUDExampleUITests" */ = { 562 | isa = XCConfigurationList; 563 | buildConfigurations = ( 564 | 18D624AE1D3E21CE00B763F8 /* Debug */, 565 | 18D624AF1D3E21CE00B763F8 /* Release */, 566 | ); 567 | defaultConfigurationIsVisible = 0; 568 | }; 569 | /* End XCConfigurationList section */ 570 | }; 571 | rootObject = 18D624721D3E21CE00B763F8 /* Project object */; 572 | } 573 | -------------------------------------------------------------------------------- /DHAlertViewHUD/DHAlertViewHUDExample/DHAlertViewHUDExample.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /DHAlertViewHUD/DHAlertViewHUDExample/DHAlertViewHUDExample/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "29x29", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "40x40", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "40x40", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "60x60", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "60x60", 31 | "scale" : "3x" 32 | } 33 | ], 34 | "info" : { 35 | "version" : 1, 36 | "author" : "xcode" 37 | } 38 | } -------------------------------------------------------------------------------- /DHAlertViewHUD/DHAlertViewHUDExample/DHAlertViewHUDExample/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 | -------------------------------------------------------------------------------- /DHAlertViewHUD/DHAlertViewHUDExample/DHAlertViewHUDExample/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 36 | 52 | 68 | 84 | 100 | 116 | 132 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | -------------------------------------------------------------------------------- /DHAlertViewHUD/DHAlertViewHUDExample/DHAlertViewHUDExample/Classes/AppDelegate/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // DHAlertViewHUDExample 4 | // 5 | // Created by Apple on 16/7/19. 6 | // Copyright © 2016年 dingding3w. 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 | -------------------------------------------------------------------------------- /DHAlertViewHUD/DHAlertViewHUDExample/DHAlertViewHUDExample/Classes/AppDelegate/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // DHAlertViewHUDExample 4 | // 5 | // Created by Apple on 16/7/19. 6 | // Copyright © 2016年 dingding3w. 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 | -------------------------------------------------------------------------------- /DHAlertViewHUD/DHAlertViewHUDExample/DHAlertViewHUDExample/Classes/ViewController/ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // DHAlertViewHUDExample 4 | // 5 | // Created by Apple on 16/7/19. 6 | // Copyright © 2016年 dingding3w. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ViewController : UIViewController 12 | 13 | 14 | @end 15 | 16 | -------------------------------------------------------------------------------- /DHAlertViewHUD/DHAlertViewHUDExample/DHAlertViewHUDExample/Classes/ViewController/ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.m 3 | // DHAlertViewHUDExample 4 | // 5 | // Created by Apple on 16/7/19. 6 | // Copyright © 2016年 dingding3w. All rights reserved. 7 | // 8 | 9 | #import "ViewController.h" 10 | #import "DHAlertViewHUD.h" 11 | 12 | @interface ViewController () 13 | 14 | @end 15 | 16 | @implementation ViewController 17 | 18 | - (void)viewDidLoad { 19 | [super viewDidLoad]; 20 | // Do any additional setup after loading the view, typically from a nib. 21 | } 22 | 23 | - (void)didReceiveMemoryWarning { 24 | [super didReceiveMemoryWarning]; 25 | // Dispose of any resources that can be recreated. 26 | } 27 | #pragma mark - 无按钮自动消失样式 28 | - (IBAction)automaticallyDisappearButtonClick:(id)sender { 29 | DHAlertViewHUD *alertView = [[DHAlertViewHUD alloc] initWithTitle:@"标题" message:@"自动消失" cancelButtonTitle:nil otherButtonTitle:nil alertViewClickIndexBlock:^(NSInteger alertViewClickIndex) { 30 | NSLog(@"SDK会自动检测,当无按钮显示时HUD自动消失"); 31 | }]; 32 | [alertView showDHAlertViewHUD]; 33 | } 34 | 35 | #pragma mark - 从上面滑落弹出样式 36 | - (IBAction)aboveSlipButtonClock:(id)sender { 37 | DHAlertViewHUD *alertView = [[DHAlertViewHUD alloc] initWithTitle:@"标题" message:@"AlertViewHUD从顶部滑落弹出" cancelButtonTitle:@"取消" otherButtonTitle:@"确定" alertViewClickIndexBlock:^(NSInteger alertViewClickIndex) { 38 | NSLog(@"您点击了第 %zd 个按钮", alertViewClickIndex); 39 | }]; 40 | [alertView setAlertViewAnimationStyle:DDShowAlertViewAnimationStyleTop]; 41 | [alertView showDHAlertViewHUD]; 42 | } 43 | 44 | #pragma mark - 从左边平滑弹出样式 45 | - (IBAction)leftSmoothButtonClick:(id)sender { 46 | DHAlertViewHUD *alertView = [[DHAlertViewHUD alloc] initWithTitle:@"标题" message:@"AlertViewHUD从左侧平滑弹出" cancelButtonTitle:@"取消" otherButtonTitle:@"确定" alertViewClickIndexBlock:^(NSInteger alertViewClickIndex) { 47 | NSLog(@"您点击了第 %zd 个按钮", alertViewClickIndex); 48 | }]; 49 | [alertView setAlertViewAnimationStyle:DDShowAlertViewAnimationStyleLeft]; 50 | [alertView showDHAlertViewHUD]; 51 | } 52 | 53 | #pragma mark - 从下面上升弹出样式 54 | - (IBAction)followingUpButtonClick:(id)sender { 55 | DHAlertViewHUD *alertView = [[DHAlertViewHUD alloc] initWithTitle:@"标题" message:@"AlertViewHUD从下边上升弹出" cancelButtonTitle:@"取消" otherButtonTitle:@"确定" alertViewClickIndexBlock:^(NSInteger alertViewClickIndex) { 56 | NSLog(@"您点击了第 %zd 个按钮", alertViewClickIndex); 57 | }]; 58 | [alertView setAlertViewAnimationStyle:DDShowAlertViewAnimationStyleBottom]; 59 | [alertView showDHAlertViewHUD]; 60 | } 61 | 62 | #pragma mark - 从右边平滑弹出样式 63 | - (IBAction)rightSmoothButtonClick:(id)sender { 64 | DHAlertViewHUD *alertView = [[DHAlertViewHUD alloc] initWithTitle:@"标题" message:@"AlertViewHUD从右边平滑弹出" cancelButtonTitle:@"取消" otherButtonTitle:@"确定" alertViewClickIndexBlock:^(NSInteger alertViewClickIndex) { 65 | NSLog(@"您点击了第 %zd 个按钮", alertViewClickIndex); 66 | }]; 67 | [alertView setAlertViewAnimationStyle:DDShowAlertViewAnimationStyleRight]; 68 | [alertView showDHAlertViewHUD]; 69 | } 70 | 71 | #pragma mark - 默认样式 72 | - (IBAction)defaultStyleButtonClick:(id)sender { 73 | DHAlertViewHUD *alertView = [[DHAlertViewHUD alloc] initWithTitle:@"标题" message:@"AlertViewHUD默认样式" cancelButtonTitle:@"取消" otherButtonTitle:@"确定" alertViewClickIndexBlock:^(NSInteger alertViewClickIndex) { 74 | NSLog(@"您点击了第 %zd 个按钮", alertViewClickIndex); 75 | }]; 76 | [alertView showDHAlertViewHUD]; 77 | } 78 | 79 | #pragma mark - 单个按钮弹出/消失样式 80 | - (IBAction)singleButtonClick:(id)sender { 81 | DHAlertViewHUD *alertView = [[DHAlertViewHUD alloc] initWithTitle:@"标题" message:@"AlertViewHUD单个按钮样式" cancelButtonTitle:@"取消" otherButtonTitle:nil alertViewClickIndexBlock:^(NSInteger alertViewClickIndex) { 82 | NSLog(@"您点击了第 %zd 个按钮", alertViewClickIndex); 83 | }]; 84 | [alertView setAlertViewAnimationStyle:DDShowAlertViewAnimationStyleTop]; 85 | [alertView showDHAlertViewHUD]; 86 | } 87 | 88 | #pragma mark - DHAlertViewHUD随机样式 89 | - (IBAction)randomStylesButtonClick:(id)sender { 90 | DHAlertViewHUD *alertView = [[DHAlertViewHUD alloc] initWithTitle:@"标题" message:@"AlertViewHUD单个按钮样式" cancelButtonTitle:@"取消" otherButtonTitle:@"确定" alertViewClickIndexBlock:^(NSInteger alertViewClickIndex) { 91 | NSLog(@"您点击了第 %zd 个按钮", alertViewClickIndex); 92 | }]; 93 | [alertView setAlertViewAnimationStyle:arc4random() % 5]; 94 | NSLog(@"%d", arc4random() % 5); 95 | [alertView showDHAlertViewHUD]; 96 | } 97 | 98 | @end 99 | -------------------------------------------------------------------------------- /DHAlertViewHUD/DHAlertViewHUDExample/DHAlertViewHUDExample/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 | 40 | 41 | -------------------------------------------------------------------------------- /DHAlertViewHUD/DHAlertViewHUDExample/DHAlertViewHUDExample/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // DHAlertViewHUDExample 4 | // 5 | // Created by Apple on 16/7/19. 6 | // Copyright © 2016年 dingding3w. 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 | -------------------------------------------------------------------------------- /DHAlertViewHUD/DHAlertViewHUDExample/DHAlertViewHUDExampleTests/DHAlertViewHUDExampleTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // DHAlertViewHUDExampleTests.m 3 | // DHAlertViewHUDExampleTests 4 | // 5 | // Created by Apple on 16/7/19. 6 | // Copyright © 2016年 dingding3w. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface DHAlertViewHUDExampleTests : XCTestCase 12 | 13 | @end 14 | 15 | @implementation DHAlertViewHUDExampleTests 16 | 17 | - (void)setUp { 18 | [super setUp]; 19 | // Put setup code here. This method is called before the invocation of each test method in the class. 20 | } 21 | 22 | - (void)tearDown { 23 | // Put teardown code here. This method is called after the invocation of each test method in the class. 24 | [super tearDown]; 25 | } 26 | 27 | - (void)testExample { 28 | // This is an example of a functional test case. 29 | // Use XCTAssert and related functions to verify your tests produce the correct results. 30 | } 31 | 32 | - (void)testPerformanceExample { 33 | // This is an example of a performance test case. 34 | [self measureBlock:^{ 35 | // Put the code you want to measure the time of here. 36 | }]; 37 | } 38 | 39 | @end 40 | -------------------------------------------------------------------------------- /DHAlertViewHUD/DHAlertViewHUDExample/DHAlertViewHUDExampleTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /DHAlertViewHUD/DHAlertViewHUDExample/DHAlertViewHUDExampleUITests/DHAlertViewHUDExampleUITests.m: -------------------------------------------------------------------------------- 1 | // 2 | // DHAlertViewHUDExampleUITests.m 3 | // DHAlertViewHUDExampleUITests 4 | // 5 | // Created by Apple on 16/7/19. 6 | // Copyright © 2016年 dingding3w. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface DHAlertViewHUDExampleUITests : XCTestCase 12 | 13 | @end 14 | 15 | @implementation DHAlertViewHUDExampleUITests 16 | 17 | - (void)setUp { 18 | [super setUp]; 19 | 20 | // Put setup code here. This method is called before the invocation of each test method in the class. 21 | 22 | // In UI tests it is usually best to stop immediately when a failure occurs. 23 | self.continueAfterFailure = NO; 24 | // UI tests must launch the application that they test. Doing this in setup will make sure it happens for each test method. 25 | [[[XCUIApplication alloc] init] launch]; 26 | 27 | // In UI tests it’s important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this. 28 | } 29 | 30 | - (void)tearDown { 31 | // Put teardown code here. This method is called after the invocation of each test method in the class. 32 | [super tearDown]; 33 | } 34 | 35 | - (void)testExample { 36 | // Use recording to get started writing UI tests. 37 | // Use XCTAssert and related functions to verify your tests produce the correct results. 38 | } 39 | 40 | @end 41 | -------------------------------------------------------------------------------- /DHAlertViewHUD/DHAlertViewHUDExample/DHAlertViewHUDExampleUITests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /DHAlertViewHUD/DesignSketchGIF/Untitled-1.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dingding3w/DHAlertViewHUD/4ea7e2394afa52c5cc0aac28bf728b20654f56f5/DHAlertViewHUD/DesignSketchGIF/Untitled-1.gif -------------------------------------------------------------------------------- /DHAlertViewHUD/DesignSketchGIF/Untitled-2.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dingding3w/DHAlertViewHUD/4ea7e2394afa52c5cc0aac28bf728b20654f56f5/DHAlertViewHUD/DesignSketchGIF/Untitled-2.gif -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016 dingding3w 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 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # DHAlertViewHUD 2 | ###快速集成APP提示框,包含淡入淡出\下滑弹出\左滑弹出\上滑弹出\右滑弹出\自动消失\手动消失等效果; 3 | ## 效果图展示: 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 |
DDAlertViewButtonStyleInlineDDAlertViewButtonStylePlain
17 | 18 | ## 方法说明: 19 | ```objc 20 | /** 21 | * 自定义初始化DHAlertViewHUD 22 | * 23 | * @param title 标题 24 | * @param message 内容 25 | * @param cancelButtonTitle 按钮一 26 | * @param otherButtonTitle 按钮二 27 | * @param alertViewClickBlock 点击按钮回调Block(内联方法block) 28 | * 29 | * @return 自定义初始化DHAlertViewHUD对象 30 | */ 31 | - (instancetype)initWithTitle:(NSString *)title message:(NSString *)message cancelButtonTitle:(NSString *)cancelButtonTitle otherButtonTitle:(NSString *)otherButtonTitle alertViewClickIndexBlock:(DDAlertViewHUDClickIndexBlock)alertViewClickBlock; 32 | ``` 33 | ```objc 34 | /** 35 | * 显示DHAlertViewHUD 36 | */ 37 | - (void)showDHAlertViewHUD; 38 | ``` 39 | 40 | ## 使用方式: 41 | ####1.下载项目或者下载项目中DHAlertViewHUD这个文件,将下载好的文件拖拽到自己的工程文件夹中,并在使用DHAlertViewHUD的类中导入#import "DHAlertViewHUD.h"头文件; 42 | 43 | ####2.初始化并使用DHAlertViewHUD视图(例) 44 | ```objc 45 | // 创建DHAlertViewHUD 46 | DHAlertViewHUD *alertView = [[DHAlertViewHUD alloc] initWithTitle:@"标题" message:@"内容" cancelButtonTitle:@"取消" otherButtonTitle:@"确定" alertViewClickIndexBlock:^(NSInteger alertViewClickIndex) { 47 | NSLog(@"您点击了第 %zd 个按钮", alertViewClickIndex); 48 | }]; 49 | // 设置DHAlertViewHUD弹出样式(不设置则显示默认样式) 50 | [alertView setAlertViewAnimationStyle:DDShowAlertViewAnimationStyleTop]; 51 | // 设置DHAlertViewHUD按钮样式(不设置则显示DDAlertViewButtonStyleInline样式,该样式即为默认样式) 52 | [alertView setAlertViewButtonStyle:DDAlertViewButtonStylePlain]; 53 | // 显示DHAlertViewHUD 54 | [alertView showDHAlertViewHUD]; 55 | ``` 56 | ## 部分代码说明: 57 | ####1.创建并初始化DHAlertViewHUD方式时,该SDK会自动检测当前按钮的值: ①当两个按钮值同时为nil时会取消按钮的显示并默认添加自动消失的效果; ②当其中一个按钮为nil时会默认添加一个按钮并自动分配相应的大小; ③当两个按钮同时有值时正常显示; 58 | 59 | ####2.设置DHAlertViewHUD的弹出样式: 60 | ```objc 61 | // 默认效果 62 | DDShowAlertViewAnimationStyleDefault 63 | // 从顶部滑落 64 | DDShowAlertViewAnimationStyleTop 65 | // 从左边弹出 66 | DDShowAlertViewAnimationStyleLeft 67 | // 从下面弹出 68 | DDShowAlertViewAnimationStyleBottom 69 | // 从右面弹出 70 | DDShowAlertViewAnimationStyleRight 71 | // 没有效果 72 | DDShowAlertViewAnimationStyleNO 73 | // 对应实现的方法是: 74 | [alertView setAlertViewAnimationStyle:<#(DDShowAlertViewAnimationStyle)#>]; 75 | ``` 76 | 77 | ####3.设置DHAlertViewHUD按钮的样式: 78 | ```objc 79 | // 默认效果(Inline) 80 | DDAlertViewButtonStyleInline 81 | // 平铺效果(Plain) 82 | DDAlertViewButtonStylePlain 83 | // 对应实现的方法是: 84 | [alertView setAlertViewButtonStyle:<#(DDAlertViewButtonStyle)#>] 85 | ``` 86 | 87 | 88 | ## <<分享是一种美德,Star是一种鼓励![image](https://github.com/dingding3w/DHGuidePageHUD/blob/master/DHGuidePageHUD/DHGuidePageHUDExample/DHGuidePageHUDExampleUITests/Untitled-star/Untitled-star.png)>> 89 | --------------------------------------------------------------------------------