| 测试已测试 | ✗ |
| 语言语言 | Objective-CObjective C |
| 许可证 | MIT |
| 发布日期最后发布 | 2017年6月 |
由Dmitriy Titov维护。
这是一个适用于您想要呈现为警告视图的任何视图的灵活、动画容器。每次您需要自定义警告视图时,都需要创建自定义视图控制器并以模态方式呈现它。配置所有布局、动画、性能需要花费时间。让DTAlertViewContainer为您完成。只需创建您的视图,并调用DTAlertViewContainer来呈现它。
DTAlertViewContainer执行与呈现警告相关的最普通的工作
UIView。UIScrollView上,所以您的AlertView有多高没关系使用CocoaPods
pod 'DTAlertViewContainer'注意:您的AlertView必须符合DTAlertView协议!
DTAlertViewContainerController *container = [[DTAlertViewContainerController alloc] init];
MyAlertView *alertView = [[MyAlertView alloc] init];
// Some configurations
[container presentOverVC:currentViewController alertView:alertView appearenceAnimation:DTAlertViewContainerAppearenceTypeFromTop completion:nil];let container = DTAlertViewContainerController()
let alertView = MyAlertView()
// Some configurations
container.presentOverVC(mainNavigationController.topViewController, alert: alertView, appearenceAnimation: .fromTop, completion: nil)您还可以配置以下内容:
如果,例如,有两个UITextField要在Return按钮按下时从第一个响应者切换到第二个,您需要执行其代码作为DTAlertViewContainerController方法performTextInputSwitch:的参数
[container performTextInputSwitch:^{
[destinationTextField becomeFirstResponder];
}];当输入源切换时,键盘隐藏并立即再次出现。这迫使容器布局两次,具有不同的键盘框架。使用该方法,您可以避免文本字段在切换时“跳跃”。请
通过 DTAlertViewContainerProtocol 与容器交互
只需调用容器的 dismiss 方法即可取消它。它也将调用 dismissAction
iOS 10 更早的版本支持即将上线