简体   繁体   English

更改UIAlertView按钮的布局

[英]Change UIAlertView button layout

I want to show two buttons in 'UIAlertview'. 我想在“ UIAlertview”中显示两个按钮。 Because the button text is very long, I want the buttons to appear one above the other in a vertical stack instead of side by side. 因为按钮文本很长,所以我希望按钮在垂直堆栈中而不是并排出现在另一个之上。 Is it possible to do this? 是否有可能做到这一点?

Unfortunately your only choices are to either make the button text shorter or to add another button. 不幸的是,您唯一的选择是使按钮文本更短或添加另一个按钮。 UIAlertView only lays out rows of buttons when there are more than two. UIAlertView仅在按钮行多于两个时才进行布局。

Aside from that, you can subclass UIAlertView, but it would probably be easier to simply create your own custom view / view controller at that point. 除此之外,还可以继承UIAlertView的子类,但是此时简单地创建自己的自定义视图/视图控制器可能会更容易。

您将需要子类化UIAlertView并使用您所描述的按钮创建自己的自定义警报。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM