SSGentleAlertView 1.0.1

SSGentleAlertView 1.0.1

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

未注册 维护。



  • tokorom
  • 它比 UIAlertView 更温和
  • 它可以像 UIAlertView 一样使用
  • 它可以更改外观,而不同于 UIAlertView

Atsushi Morino 设计

外观和感觉

默认

SSGentleAlertViewDefault

黑色

SSGentleAlertViewBlack

原生

SSGentleAlertViewNative

支持的 UIAlertView 属性和方法

@property (nonatomic, weak) id delegate;
@property (nonatomic, copy) NSString* title;
@property (nonatomic, copy) NSString* message;
@property (nonatomic, readonly, getter=isVisible) BOOL visible;
@property (nonatomic) NSInteger cancelButtonIndex;
@property (nonatomic, readonly) NSInteger numberOfButtons;

- (id)initWithTitle:(NSString*)title message:(NSString*)message delegate:(id)delegate cancelButtonTitle:(NSString*)cancelButtonTitle otherButtonTitles:(NSString*)otherButtonTitles, ...;
- (void)show;
- (NSInteger)addButtonWithTitle:(NSString*)title;
- (NSString*)buttonTitleAtIndex:(NSInteger)buttonIndex;

附加功能

/*
 * If set YES to this property, the dialog can be closed in the tap to the background part
 */
@property (nonatomic) BOOL disappearWhenBackgroundClicked;

/*
 * It is possible to select 3 styles (SSGentleAlertViewStyleDefault or SSGentleAlertViewStyleBlack or SSGentleAlertViewStyleNative)
 * when you use the init method
 */
- (id)initWithStyle:(SSGentleAlertViewStyle)style;
- (id)initWithStyle:(SSGentleAlertViewStyle)style title:(NSString*)title message:(NSString*)message delegate:(id)delegate cancelButtonTitle:(NSString*)cancelButtonTitle otherButtonTitles:(NSString*)otherButtonTitles, ...;

代码示例

// #import "SSGentleAlertView.h"

// SSGentleAlertView can be used same way as UIAlertView

SSGentleAlertView* alert = SSGentleAlertView.new;
alert.delegate = self;
alert.title = @"SSGentleAlertView";
alert.message = @"This is GentleAlertView!\nUIAlertView is too strong to use for ordinary messages.";
[alert addButtonWithTitle:@"Cancel"];
[alert addButtonWithTitle:@"OK"];
alert.cancelButtonIndex = 0;
[alert show];

自定义外观示例

SSGentleAlertViewCustomize

// #import "SSGentleAlertView.h"
// #import "SSDialogView.h"

alert.backgroundImageView.image = [UIImage imageNamed:@"dialog_bg"];
alert.dialogImageView.image = nil;

alert.titleLabel.textColor = [UIColor colorWithRed:1.0 green:0.5 blue:0.0 alpha:1.0];
alert.titleLabel.shadowColor = UIColor.clearColor;
alert.messageLabel.textColor = [UIColor colorWithRed:0.4 green:0.2 blue:0.0 alpha:1.0];
alert.messageLabel.shadowColor = UIColor.clearColor;

UIButton* button = [alert buttonBase];
[button setBackgroundImage:[SSDialogView resizableImage:[UIImage imageNamed:@"dialog_btn_normal"]] forState:UIControlStateNormal];
[button setBackgroundImage:[SSDialogView resizableImage:[UIImage imageNamed:@"dialog_btn_pressed"]] forState:UIControlStateHighlighted];
[button setTitleColor:UIColor.whiteColor forState:UIControlStateNormal];
[button setTitleColor:UIColor.whiteColor forState:UIControlStateHighlighted];
[alert setButtonBase:button];
[alert setDefaultButtonBase:button];

入门 - 安装 SSGentleAlertView

请选择您喜欢的方式。

使用 Git

git clone git://github.com/tokorom/SSGentleAlertView.git
// git submodule add git://github.com/tokorom/SSGentleAlertView.git Externals/SSGentleAlertView

并将 SSGentleAlertView 子目录添加到您的 Xcode 项目中。

下载 ZIP 存档

下载
https://github.com/tokorom/SSGentleAlertView/archive/master.zip
并将 SSGentleAlertView 子目录添加到您的 Xcode 项目中。


英文 | 日语