UIAlertView上的按钮

时间:2014-01-08 17:38:40

标签: ios uialertview

我有一个应用程序,我想让用户从1到4做出判断。我正在使用UIAlertView:

UIAlertView *alert = [[UIAlertView alloc]initWithTitle: @"Judgment" message:@"Please choose your overall judgement." delegate: self cancelButtonTitle:nil otherButtonTitles:@"1",  @"2", @"3", @"4", nil];

虽然它有效,但视图看起来如下所示,其中数字4通常是“取消”按钮。有没有更好的方法呢?

enter image description here

3 个答案:

答案 0 :(得分:1)

您可以随时通过子类化来修改警报视图。这不是世界上最简单的事情,但我不知道另一种方法可以完成你想要做的事情。

此链接显示如何使警报视图显示您想要的内容。 http://mobile.tutsplus.com/tutorials/iphone/ios-sdk-uialertview-custom-graphics/

答案 1 :(得分:0)

您应该将取消按钮的按钮索引设置为-1:

alert.cancelButtonIndex = -1;

正如文档所说的那样cancelButtonIndex

The button indices start at 0. If -1, then the index is not set.

答案 2 :(得分:0)

检查此链接:

How to hide the close button and close action in alert view to display only "Open app" buttom。根据答案,无法隐藏取消按钮。但值得一试。

希望有所帮助

相关问题