AlertHelper
示例
要运行示例项目,请克隆仓库,然后首先从示例目录中运行 pod install
使用方法
首先应该导入头文件
#import "AlertHelper.h"
如果您想提示文本,请使用
AlertText(self.view).title(@"这是一条提示信息").show(); // it will hide delay 1.5s, replace self.view to your target source view.
如果您想弹出并且需要操作一些东西,请使用
AlertView(self.view).title(@"这是一条提示标题").message(@"这是一条提示信息").cancelButton(@"取消").confirmButton(@"确定").cancelHandler(^{
}).confirmHandler(^{
}).show();
如果您想要在消失时执行某些操作,请使用
AlertText(self.view).title(@"这是一条提示信息").show().dismissHandler(^{
// do some thing at this.
});
如果您想在窗口中弹出,请使用
AlertTextInWindow().title(@"").show();
或者
AlertViewInWindow().title(@"").message(@"").cancelButton(@"取消").confirmButton(@"确定").cancelHandler(^{
}).confirmHandler(^{
}).show();
如果您想自定义配置,请使用
AlertText(self.view).title(@"").font([UIFont ..]).titleColor([UIColor ..]).show(); // it have some comtus set, pls use it.
还可以设置全局配置,例如这样
// declare the HelperConfigurationHandler object.
void CustomConfigurationForAlertHelper(ZZAlertHelper *alertHelper);
@interface ExampleClass()
@end
@implementation ExampleClass
// call this function at app launch<AppDelegate.m> or at the global app preference.
- (void)setupAppPerference
{
// call the function to set the HelperConfigurationHandler object at AlertHelper.m.
SetupZZAlertHelperConfiguration(CustomConfigurationForAlertHelper);
}
// setup custom config at here.
void CustomConfigurationForAlertHelper(ZZAlertHelper *alertHelper)
{
alertHelper.titleLabelTextColor = [UIColor blackColor];
alertHelper.textFont = [UIFont boldSystemFontOfSize:17];
}
@end
安装
AlertHelper 通过 CocoaPods 提供。要安装它,只需将以下行添加到您的 Podfile 中
pod 'AlertHelper'
作者
阳光XG,[email protected],如有任何问题和建议,请通过电子邮件联系我,谢谢。
许可证
AlertHelper在MIT许可证下可用。请参阅LICENSE文件以获取更多信息。