iOS5: Has somebody managed to fix UIAlertView with three buttons and textfield (UIAlertViewStylePlainTextInput)?

♀尐吖头ヾ 提交于 2019-12-10 15:59:41

问题


Apple really screwed this one up. I want to use a UIAlertView with the new UIAlertViewStylePlainTextInput style and have three buttons in it. The result looks as follows:

Has somebody managed to build a workaround until Apple will have fixed this issue? Maybe reducing the button height somehow or increase the total height of the alert view?


回答1:


This is not a complete solution but it may get you started.

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 ();

I observed that the AlertView tries to be intelligent when you add a text view as a sub view. But if you put a generic UIView in as a container it gives you something more useable.

I also verified that this is a problem in XCode.

This post may give you some more ideas.



来源:https://stackoverflow.com/questions/10247413/ios5-has-somebody-managed-to-fix-uialertview-with-three-buttons-and-textfield

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!