获取UIAlertAction的大小

时间:2019-02-13 20:02:54

标签: ios cocoa-touch uialertcontroller uialertaction

是否可以从UIAlertAction获取高度/宽度?​​

它似乎不是UIView的子类,因此在UIAlertController中为其设置了常量吗?

1 个答案:

答案 0 :(得分:0)

是的,您可以通过以下方式获取UIAlertController的高度/宽度

present(alertController, animated: true, completion: nil)
DispatchQueue.main.asyncAfter(deadline: .now() + delay) {
    alertController.view.frame.height
}

注意:在当前的UIAlertController之后需要放置一些延迟 You will get alert part frame only