UIAlertView中没有取消按钮? [英] UIAlertView without Cancel Button?

查看:213
本文介绍了UIAlertView中没有取消按钮?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想创建一个有3个选项,并没有取消按钮UIAlertView中,但我这样做的时候,它总是样式按钮3作为一个取消按钮。有没有什么办法避免这种情况?

  UIAlertView中* alertView = [[UIAlertView中页头] initWithTitle:@选择一项消息:无委托:自我cancelButtonTitle:无otherButtonTitles:@按钮1,@按钮2 @按钮3,零]


解决方案

<一个href=\"http://stackoverflow.com/questions/4456675/change-position-of-cancel-button-in-uialertview\">This是关于如何改变取消按钮的位置后。另外,如果您有只有1按钮 UIAlertView中,然后设置:

  _alertView.cancelButtonIndex = -1;

可否使按钮显示为一个非取消型按钮。至于我可以告诉虽然,一旦你有超过1键, UIAlertView中强制最后一个按钮是取消按钮。翻翻<一个href=\"http://developer.apple.com/library/ios/#documentation/uikit/reference/UIAlertView_Class/UIAlertView/UIAlertView.html\">reference可能会给你一个有关如何设置属性上来实现这一线索,但我也不太清楚。希望帮助!

I am trying to create a UIAlertView that has 3 options and no "cancel" button, but when I do this, it always styles "Button 3" as a cancel button. Is there any way to avoid this?

UIAlertView *alertView= [[UIAlertView alloc] initWithTitle:@"Select One" message:nil delegate:self cancelButtonTitle:nil otherButtonTitles:@"Button 1",@"Button 2", @"Button3", nil];

解决方案

This is a post about how to change the position of the cancel button. Also, if you have only 1 button in the UIAlertView, then setting:

_alertView.cancelButtonIndex = -1;

Will make the button appear as a non-cancel type button. As far as I can tell though, once you have more than 1 button, the UIAlertView forces the last button to be the cancel button. Looking through the reference may give you a clue about how to set the properties up to achieve this, but I'm not too sure. Hope that Helps!

这篇关于UIAlertView中没有取消按钮?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆