ios - 获取 UIAlertAction 的大小
问题描述
有没有办法从 a 获取高度/宽度UIAlertAction
?
它似乎不是 的子类UIView
,所以在 中是否为它设置了一个常量UIAlertController
?
解决方案
是的,您可以通过以下方式获取 UIAlertController 的高度/宽度
present(alertController, animated: true, completion: nil)
DispatchQueue.main.asyncAfter(deadline: .now() + delay) {
alertController.view.frame.height
}
注意:需要在当前 UIAlertController 之后放置一些延迟 你只会得到警报部分框架
推荐阅读
- c# - 重新定位图表点标签
- django - 从表单集中的 ModelChoiceField 管理 Django 模型实例的另一种方法
- python - 如何使这两种关于在笛卡尔积上循环的替代方案减少冗余?
- css - 无效选择器中的 Angular 5 警告';
- r - as.Date 返回 N/A,字符串为 %d/%m/%Y,& 语言环境解决方案不会更改 R 中的输出
- entity-framework-6 - 在同一 DbContext 中设置选择性审计
- c++ - QT qScriptConnect 不工作
- singularity-container - 错误:在构建奇点容器时,在未初始化的配置子系统上调用了singularity_config_get_value
- python - 将带有注释的签名添加到扩展方法
- reactjs - 构造函数中的数组道具为空