测试测试过 | ✗ |
Lang语言 | Obj-CObjective C |
许可 | MIT |
发布最新版本 | 2014年12月 |
由Andrew Hershberger,Two Toasters维护。
TTAlertView 是 UIAlertView 的替代品,允许开发者自定义警报的展示。TTAlertView 使用熟悉的 UIAlertView 接口,所以你不需要担心重写任何代码 - 只需将其放入,添加一些资源,你就会有一个独特的、定制的警报视图!
如果你使用 git,你可以将 TTAlertView 作为子模块添加到你的项目中。否则,你可以简单地从 github 上的 master 分支下载最新的源代码。
一旦你获得了 TTAlertView 代码库,只需将 TTAlertView.h 和 TTAlertView.m 添加到你的 Xcode 项目中,并在你想使用 TTAlertView 的文件中包含 TTAlertView.h
。现在你就可以开始使用了!
使用 TTAlertView 很简单。TTAlertView 使用熟悉的 initWithTitle:message:delegate:cancelButtonTitle:otherButtonTitles:
和 show
方法来创建和显示警报视图。然后 TTAlertView 处理视图的布局和动画。
让我们看看一些代码
- (void)simpleAlert
{
TTAlertView *alert = [[TTAlertView alloc] initWithTitle:@"A Simple TTAlertView"
message:@"... with the default layout!"
delegate:self
cancelButtonTitle:@"Dismiss"
otherButtonTitles:nil];
[alert show];
}
...
这是 TTAlertView 使用的简单示例。更多关于使用 TTAlertView 的信息,请参阅ToastMo 的关于 TTAlertView 的博客文章。