【问题标题】:iOS5: Has somebody managed to fix UIAlertView with three buttons and textfield (UIAlertViewStylePlainTextInput)?iOS5:有人设法用三个按钮和文本字段(UIAlertViewStylePlainTextInput)修复 UIAlertView 吗?
【发布时间】:2012-04-20 13:39:06
【问题描述】:

Apple 真的把这件事搞砸了。我想使用 UIAlertView 和新的 UIAlertViewStylePlainTextInput 样式,并在其中包含三个按钮。结果如下:

在 Apple 解决此问题之前,是否有人设法构建了解决方法?也许以某种方式降低按钮高度或增加警报视图的总高度?

【问题讨论】:

标签: cocoa-touch uikit xamarin.ios uialertview


【解决方案1】:

这不是一个完整的解决方案,但它可以帮助您入门。

UIAlertView view = new UIAlertView ("Alert", "This is an alert\n\n\n", null, "Login", "One", "Two");

UIView theTextField = new UIView (new RectangleF (12.0f, 80.0f, 260.0f, 25.0f));
UITextView txt = new UITextView (new RectangleF (0f, 0f, 260.0f, 25.0f));
txt.BackgroundColor = UIColor.White;
theTextField.AddSubview (txt);
view.AddSubview (theTextField); 

view.Show ();

我观察到,当您将文本视图添加为子视图时,AlertView 会尝试变得智能。但是如果你把一个通用的 UIView 作为一个容器放进去,它会给你一些更有用的东西。

我还验证了这是 XCode 中的问题。

这个post 可能会给你更多的想法。

【讨论】:

  • 但是您的解决方案根本没有使用新样式。
  • 不过我现在试了一下。杰出的。像魅力一样工作!谢谢!
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2012-12-26
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2011-06-28
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多