SHAlert 0.2.0

SHAlert 0.2.0

测试已测试
语言语言 Obj-CObjective C
许可证 MIT
发布上次发布2014年12月

Seivan Heidari维护。



SHAlert 0.2.0

  • 作者:
  • Seivan Heidari

使用故事板布局的自定义警报。具有开箱即用的 Pixate 支持。使用类名作为操作、取消和破坏性(与消息、标题和警报背景)。如果您想要使用多种不同样式的警报和按钮位置,这是完美的。仍然是早期版本 0.1.1,但有大量功能在开发中。查看路线图,了解计划中的功能。

要求

需要 iOS 5 和更高版本。与自动布局配合得很好。

用法

将依赖项添加到您的 Podfile

platform :ios
pod 'SHAlert'
...

运行 pod install 安装依赖项。

接下来,在需要使用选择器的任何地方导入头文件

#import "SHAlert.h"

在故事板中设置您的视图控制器以使用 'SHViewControllerAlert',并将 setOutletCollection 和类名作为用户定义的运行时变量连接到 outlets 或描述性 outlets(这样就不需要运行时变量了)

pixate 类名如下:alert-background(视图)destructive(按钮)cancel(按钮)action(按钮)title(标签)message(标签)

而 storyboardId 将是 pixate 风格 id

注册包含您的警报的故事板。

[SHAlert registerStoryBoard:myStoryboard];

最后,在需要时呈现警报

+(SHViewControllerAlert *)alertControllerWithStoryboardId:(NSString *)storyboardId
                                                withTitle:(NSString *)theTitle
                                               andMessage:(NSString *)theMessage;

-(void)show;
-(void)dismiss;
-(void)setButtonTitleForCancel:(NSString *)theTitle withBlock:(SHAlertButtonTappedBlock)theBlock;
-(void)setButtonTitleForDestructive:(NSString *)theTitle withBlock:(SHAlertButtonTappedBlock)theBlock;
-(void)setButtonTitleForAction:(NSString *)theTitle withBlock:(SHAlertButtonTappedBlock)theBlock;

storyboardId 将是您风格中的 id

SHAlertSampleWithPixate .cancel {...}

许可证

使用提供在 MIT 许可证 下。请参阅 LICENSE 了解详细信息。