ios - 如何强制 UIAlertView 的大小合适?

标签 ios resize uialertview sizing

我有一个出现并阻止输入的 UIAlertView,但实际的“确定/取消”是 0×0(0, 0),所以它不会被用户忽略。下面是我目前的修复,但我更愿意告诉 iOS“嘿!这不对。改正它。”那么,有什么方法可以让我在 iOS 中重新定位或重置 UIAlertView 框架的位置?

if (_floatingAlert &&                                                        // if there is an alert AND...
    (_floatingAlert.visible ||                                               // ( the alert isn't visible OR...
     _floatingAlert.frame.size.height + _floatingAlert.frame.size.width == 0)//  The frame is invisibly small )
    )
{
    [_floatingAlert dismissWithClickedButtonIndex:0 animated:YES];
    _floatingAlert = nil;
}

最佳答案

Uialertview 和 uiactionsheet 已经过时,虽然它们现在仍然可以使用,但您应该考虑使用 uialertcontroller。

我目前正在做一个项目,在这个项目中我遇到了一些关于你想要做什么的评论。一种选择是将您的类设置为 uialertcontroller 委托(delegate),这听起来像是可以控制自定义外观。另一种选择是创建您自己的自定义 View ,并在需要提醒用户注意事项时将其呈现给用户。

关于ios - 如何强制 UIAlertView 的大小合适?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29306211/

相关文章:

jquery - Phonegap 和 ios - 示例在模拟器中不起作用

ios - 即使要触发的事件从 DB(核心数据)中删除,UILocalNotification 也会被触发

resize - 网格调整大小

html - Bootstrap 旋转木马箭头到屏幕边缘,调整大小,文本消失

ios - 如何在 UIAlertController 外部点击时关闭 UIAlertController?

iphone - 未调用委托(delegate)方法 "clickedButtonAtIndex:"

ios - 在 iOS 8 中更改 inputAccessoryView 的框架

iphone - 我应该在 xcode 中从哪个模板开始?

javascript - 如何在 Backbone View 中获取调整大小事件?

ios - 如何在 UIAlertView 中容纳 8 个按钮