Tag: uialertview

以编程方式隐藏UIAlertView?

有没有办法隐藏UIAlertView编程? 其实我在UIAlertView中添加了一个UITextField,当用户敲击键盘返回键时,我想要执行和“Ok”button相同的操作。

代表的几个UIAlertViews

目前我有一个类在这里和那里popupUIAlertView 。 目前,同一个class级是这些class级的代表(这是非常合乎逻辑的)。 不幸的是,这些UIAlertView会调用类的相同委托方法。 现在,问题是 – 你怎么知道从哪个alert视图中调用委托方法? 我只是想检查警报视图的标题,但这不是那么优雅。 什么是处理多个UIAlertView的最优雅的方式?

为UIAlertAction编写处理程序

我向用户展示一个UIAlertView ,我不知道如何编写处理程序。 这是我的尝试: let alert = UIAlertController(title: "Title", message: "Message", preferredStyle: UIAlertControllerStyle.Alert) alert.addAction(UIAlertAction(title: "Okay", style: UIAlertActionStyle.Default, handler: {self in println("Foo")}) 我在Xcode中遇到了一堆问题。 文档中提到了convenience init(title title: String!, style style: UIAlertActionStyle, handler handler: ((UIAlertAction!) -> Void)!) 现在,整个街区/封闭物都比我头高一点。 任何build议都非常感谢。

UIAlertView addSubview在iOS7中

在iOS7中,使用addSubview方法不推荐将一些控件添加到UIAlertView 。 据我所知苹果承诺添加contentView属性。 现在iOS 7发布了,我发现这个属性没有添加。 这就是为什么我search能够添加进度条到这个alertView的一些自定义的解决scheme。 比如类似TSAlertView的东西,但是更适合在iOS 7中使用 。

无法将UITextField添加到iOS7上的UIAlertView …在iOS 6中可用

下面的代码工作在iOS6(和之前),但UITextField不显示在iOS7 …任何想法如何让UITextField显示在UIAlterView在iOS7? UIAlertView* dialog = [[UIAlertView alloc] init]; [dialog setDelegate:self]; [dialog setTitle:@"Enter ESC Score"]; [dialog setMessage:@" "]; [dialog addButtonWithTitle:@"Cancel"]; [dialog addButtonWithTitle:@"OK"]; dialog.tag = 5; nameField = [[UITextField alloc] initWithFrame:CGRectMake(20.0, 45.0, 245.0, 25.0)]; [nameField setKeyboardType:UIKeyboardTypeNumberPad]; [nameField becomeFirstResponder]; [nameField setBackgroundColor:[UIColor whiteColor]]; [dialog addSubview:nameField]; CGAffineTransform moveUp = CGAffineTransformMakeTranslation(0.0, 0.0); [dialog setTransform: moveUp]; [dialog show]; [dialog release]; [nameField release]; […]

添加一个简单的UIAlertView

什么是我可以使用一个简单的UIAlertView有一个“确定”button的启动代码?

通过传递数组而不是varlist来创buildUIActionSheet'otherButtons'

我有一个string数组,我想在UIActionSheet上使用button标题。 不幸的是,方法调用中的otherButtonTitles:参数需要一个可变长度的string列表,而不是一个数组。 那么我怎样才能将这些标题传递给UIActionSheet? 我见过的解决方法是将nil传递给otherButtonTitles,然后使用addButtonWithTitle:来分别指定button标题。 但是,这有一个问题,将“取消”button移到UIActionSheet的第一个位置,而不是最后一个; 我希望它是最后一个。 有没有办法1)传递数组来代替string的variables列表,或者2)将取消button移动到UIActionSheet的底部? 谢谢。

是否有可能在UIAlertView中显示图像?

是否有可能在UIAlertView中添加图像,如显示来自plist文件的图像?

UIAlertView / UIAlertController兼容iOS 7和iOS 8

我正在使用Swift写一个应用程序,我需要显示一个警报。 该应用程序必须与iOS 7和iOS 8兼容。 由于UIAlertView已被replace为UIAlertController ,如何检查UIAlertController是否可用而不检查系统版本? 我一直听说苹果build议我们不要检查设备的系统版本,以确定API的可用性。 这是我正在使用的iOS 8,但这在iOS 7上崩溃与“ dyld: Symbol not found: _OBJC_CLASS_$_UIAlertAction ”: let alert = UIAlertController(title: "Error", message: message, preferredStyle: .Alert) let cancelAction = UIAlertAction(title: "OK", style: .Cancel, handler: nil) alert.addAction(cancelAction) presentViewController(alert, animated: true, completion: nil) 如果我使用iOS 8的UIAlertView,我得到这个警告: Warning: Attempt to dismiss from view controller <_UIAlertShimPresentingViewController: 0x7bf72d60> while a presentation or […]

iPhone SDK:检查是否显示UIAlertView

我有一个方法,张贴HTTP数据,并显示一个UIAlertView如果有错误。 如果我有多个HTTP发布,我会为每个错误显示多个UIAlertView。 如果不显示其他UIAlertView,我只想显示一个UIAlertView。 我怎样才能确定这一点?