Tag: uialertview

检查是否在iOS 6中安装了Google Maps App

我想弄清楚如何处理这段代码的结果,看是否在应用程序中安装了谷歌地图。 [[UIApplication sharedApplication] canOpenURL: [NSURL URLWithString:@"comgooglemaps://"]]; 我正在创build一个UIAlertView在那里的选项,如果是或不是我想给用户不同的选项。 我如何把上面的代码的结果变成一个BOOLEAN? 提前致谢。

SWIFT – 添加图像以提醒视图

我有一个警告视图,当用户按下添加button时popup。 如何将图像添加到警报视图? 我添加了一些我从堆栈溢出引用的代码。 我的保存button被replace为图像,图像显示为蓝色… 警报视图代码 var alert = UIAlertController(title: "Spring Element \(springNumber)", message: "Add spring properties", preferredStyle: .Alert) let saveAction = UIAlertAction(title: "Save", style: .Default) { (action: UIAlertAction!) -> Void in let textField1 = alert.textFields![0] as UITextField self.txtField1.append(textField1.text) self.tableView.reloadData() let textField2 = alert.textFields![1] as UITextField self.txtField2.append(textField2.text) self.tableView.reloadData() println(self.txtField1) println(self.txtField2) } let cancelAction = UIAlertAction(title: "Cancel", […]

在UIAlertView iOS 8 beta 5中没有标题的UI问题

在iOS 8上运行我们的应用程序时,我遇到了与UIAlertView有关的问题。我显示标题为nil的警报。 它在iOS 7中工作正常,但现在UI看起来很奇怪。 我在这里附上截图。 我发现一个解决scheme是,当我提供空string@“”它看起来没问题。 看下面的截图。 但我不知道我提到的问题是testing版iOS 8版本中的错误还是有其他更好的解决scheme。 即使是解决scheme,它也不像iOS 7那样精确。 iOS 7 – 显示标题为nil的警报视图。 这里截图。

UIAlertAction处理程序在延迟之后运行

我试图将我的UIAlertViews更改为UIAlertControllers。 我为此设置了这个动作: UIAlertAction *undoStopAction = [UIAlertAction actionWithTitle:@"Undo Stop" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) { [self undoStop]; }]; 但是,处理程序不会运行,直到动作被点击后一秒左右。 有什么办法可以加速吗?

从UICollectionView中删除一个项目

我有一组图像显示在UICollectionView 。 当用户点击图像时,会产生一个UIActionSheet其中包含该图像的几个选项。 其中一个ID从UICollectionView删除照片。 当用户在UIActionSheetselect删除button时,它会popup一个警告视图,要求确认。 如果用户select是,它应该删除照片。 我的问题是,要从UICollectionView删除项目,您必须将indexPath传递给deleteItemsAtIndexPaths事件。 由于最终确认是在alert视图的didDismissWithButtonIndex事件中授予的,所以我找不到从这里获取所选图像的indexPath并将其传递给deleteItemsAtIndexPaths事件的方法。 我怎样才能做到这一点? 这是我的代码: – (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex { switch (buttonIndex) { case 0: deletePhotoConfirmAlert = [[UIAlertView alloc] initWithTitle:@"Remove Photo" message:@"Do you want to remove this photo?" delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:nil, nil]; [deletePhotoConfirmAlert addButtonWithTitle:@"Yes"]; [deletePhotoConfirmAlert show]; break; case 1: NSLog(@"To Edit photo"); break; } } – (void)alertView:(UIAlertView *)alertView didDismissWithButtonIndex:(NSInteger)buttonIndex { […]

键盘失去隐藏能力“如果我使用UIAlertView”

我正在编写一些iPad应用程序,并开始出现一个奇怪的效果。 我使用一个导航栏,所以我可以通过我的意见自由导航。 无论如何,在这些内部视图之一中,我提供了检查用户是否真的想通过警报视图返回到主视图的可能性(只是一对/一对button)。 一旦用户确认他想回去,然后我“手动”popup视图,然后导航到键盘隐藏的主视图。 但是,事情是虚拟键盘行为怪异。 在“内部视图”中,键盘在90%的时间内是可见的(这是正常的,周围有很多UITextFields)。 每当我想让它隐藏起来,我该怎么做才能隐藏它? 我把这样的东西放在“主视图将会出现”: [self.view endEditing:YES]; 显然它隐藏了键盘,当我这样做: [[self navigationController] popToRootViewControllerAnimated:YES]; iPad导航回来,然后键盘消失。 没什么大不了的(第一次)。 但后来我决定重新进入相​​同的观点,所以键盘出现,我做了一些花哨的东西。 然后,我决定放弃(用我的button),我再次显示相同的警报视图,我确认我想回到主视图(就像以前一样)。 代码是一样的,但是在主视图中, [self.view endEditing:YES]; 线,什么都不做,什么是最糟糕的,我已经失去了在我的应用程序内部通过代码ANYWHEREclosures键盘的能力。 为什么我知道UIAlertView有什么function? 因为如果我改变我的“中止button”里面的代码: alertViewQuestionType=ALERT_ABANDON_TEST; UIAlertView *alert = [[[UIAlertView alloc] initWithTitle:@"" message:NSLocalizedStringFromTable (@"STR_ABANDON_TEST_WARNING", @"ui_strings", @"") delegate:self cancelButtonTitle:NSLocalizedStringFromTable (@"STR_CANCEL", @"ui_strings", @"") otherButtonTitles:nil] autorelease]; [alert addButtonWithTitle:NSLocalizedStringFromTable (@"STR_ABANDON", @"ui_strings", @"")]; [alert show]; 对此: [[self navigationController] popToRootViewControllerAnimated:YES]; (也就是说,没有用户的确认,只要按下放弃button,用户只需导航回来),那么当主视图到达“viewWillAppear”函数时,隐藏键盘编码就起作用。 不仅如此,而且一直到我的应用程序会话结束。 […]

UIAlertView for iOS 9的替代scheme?

UAlertView在iOS 9及更高版本中已弃用。 什么是替代? UIAlertView *new = [[UIAlertView alloc] initWithTitle:@"Success" message:@"Your InApp Purchases were successfully restored" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil]; [new show];

UIAlertView:取消button应该在哪里?

iOS中的alertviews: 安装应用程序OTA:取消button位于左侧。 删除应用程序:取消button在右侧。 取消button应该在哪里?

在iOS 9.0中,“UIAlertView”已被弃用。 相反,使用UIAlertController和UIAlertControllerStyleAlert的preferredStyle

我已经看到了更多的答案,但没有什么帮助。这是我的老警戒和行动 override func viewWillAppear(animated: Bool) { if Reachability.isConnectedToNetwork() == true { print("internet connection ok") } else { print("internet not ok") let alertView: UIAlertView = UIAlertView(title: "Alert ", message: "connect to internet", delegate: self, cancelButtonTitle: "settings", otherButtonTitles: "cancel") alertView.show() return } } func alertView(alertView: UIAlertView, clickedButtonAtIndex buttonIndex: Int) { if buttonIndex == 0 { //This will […]

UIAlertView可以传递一个string和一个int通过委托

我有一个UIAlertView(事实上),我使用的方法-(void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex触发一个动作,如果用户不按下取消。 这是我的代码: – (void)doStuff { // complicated time consuming code here to produce: NSString *mySecretString = [self complicatedRoutine]; int myInt = [self otherComplicatedRoutine]; UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"HERE'S THE STUFF" message:myPublicString // derived from mySecretString delegate:nil cancelButtonTitle:@"Cancel" otherButtonTitles:@"Go On", nil]; [alert setTag:3]; [alert show]; [alert release]; } 然后我想要做的是以下几点: – (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex […]