这是一个非常简单(且可定制)的警告替换方案,基于Facebook的Slingshot应用,并受到SVProgressHUD的启发(是的,使用起来就像SV一样简单)
twitter <--- 我不太发推文,所以不会向您垃圾邮件
比较UIAlertView、SVProgressHUD和RKdropdownAlert的文章
https://medium.com/@cwRichardKim/devux-uialertview-alternatives-3a78ab64cbf8
等等!如果您想自定义或使用快速简便的[RKDropdownAlert show],请不要使用Pods
pod 'RKDropdownAlert'
[RKDropdownAlert title:@"Hello World" message:@"Tons better than UIAlertView!"];
[RKDropdownAlert show];
设置默认文本、颜色、大小、字体等,以便在调用“show”时拉出一个简单默认调用
首先,下载文件,或创建仓库的分支。将以下内容复制到您的父控制器中
#import "RKDropdownAlert.h"
您可能想要自定义默认调用 ([RKDropdownAlert show]),以及其他如颜色、用户点击视图时调用的方法等功能。查找
//%%% CUSTOMIZE
RKDropdownAlert.m 中的标签以查找您应自定义的方法。
使用以下变体:标题、消息、backgroundColor、textColor和time
+(void)show;
+(void)title:(NSString*)title;
+(void)title:(NSString*)title time:(NSInteger)seconds;
+(void)title:(NSString*)title backgroundColor:(UIColor*)backgroundColor textColor:(UIColor*)textColor;
+(void)title:(NSString*)title backgroundColor:(UIColor*)backgroundColor textColor:(UIColor*)textColor time:(NSInteger)seconds;
+(void)title:(NSString*)title message:(NSString*)message;
+(void)title:(NSString*)title message:(NSString*)message time:(NSInteger)seconds;
+(void)title:(NSString*)title message:(NSString*)message backgroundColor:(UIColor*)backgroundColor textColor:(UIColor*)textColor;
+(void)title:(NSString*)title message:(NSString*)message backgroundColor:(UIColor*)backgroundColor textColor:(UIColor*)textColor time:(NSInteger)seconds;
例如
[RKDropdownAlert show];
[RKDropdownAlert title:@"this is a title" message:@"this is a one line message"];
[RKDropdownAlert title:@"Hello World" message:@"tons better than UIAlertView" backgroundColor:[UIColor grayColor] textColor:[UIColor whiteColor] time:10];
编写用户触摸视图时的自定义方法(默认是隐藏视图)
@interface WhateverClassYouLike : NSObject <RKDropdownAlertDelegate>
@end
@implementation WhateverClassYouLike
-(BOOL)dropdownAlertWasTapped:(RKDropdownAlert*)alert {
// Handle the tap, then return whether or not the alert should hide.
return true;
}
@end