Tag: uialertcontroller

如何在UIAlertController中使用UITextView

我使用警报控制器创build了一个popup警报,并添加了两个警报操作(ok和cancel),如下所示。 UIAlertController * alert= [UIAlertController alertControllerWithTitle:@"Cycling" message:@"Please enter title and description" preferredStyle:UIAlertControllerStyleAlert]; UIAlertAction* ok = [UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleDefault handler:^(UIAlertAction * action) { [alert dismissViewControllerAnimated:YES completion:nil]; }]; UIAlertAction* cancel = [UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleDefault handler:^(UIAlertAction * action) { [alert dismissViewControllerAnimated:YES completion:nil]; }]; [alert addAction:ok]; [alert addAction:cancel]; [self presentViewController:alert animated:YES completion:nil]; 现在,我想添加UITextView。 因为我有两个文本字段,如标题和说明。 为了说明我想使用UITextView添加no.of行。 我试过我没有得到如何添加它。 请指教。

iOS-8及更高版本 – UIAlertController中的UITableView

我知道如何通过使用像UITableView accessoryView UIAlertView添加任何Custom UI ,但我现在好奇,如果我们仍然有select添加Custom UI内UIAlertController ,我想要的是一个UIAlertController内清醒的UIAlertController 。

iOS 8只有使用UIAlertController或UIActionSheet的内存泄漏

当我在UIActionSheet或UIAlertController中执行以下操作时,我在模拟器中看到了iOS 8中的内存泄漏。 UIActionSheet在IOS 8中使用UIAlertController,所以问题是相关的。 showCameraAction在按下button时被调用。 我已经从委托方法中删除了所有的内容,并仍然在下面的情况下泄漏。 我是否以某种方式使用UIActionSheet? 我将不胜感激任何帮助解决这个问题。 相同的代码没有IOS 7泄漏(在模拟器中)。 -(IBAction)showCameraAction:(id)sender { UIActionSheet* actionSheet = [[UIActionSheet alloc] initWithTitle:@"Photo From:" delegate:self cancelButtonTitle:@"Cancel" destructiveButtonTitle:nil otherButtonTitles:@"Phone", @"Flickr", nil]; [actionSheet showInView:[[UIApplication sharedApplication] keyWindow]]; //also tried just showInView: self.view } //空 – (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex { } 也尝试与UIAlertController,具有相同的结果: UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@"Photo From:" message:@"" preferredStyle:UIAlertControllerStyleActionSheet]; UIAlertAction *phoneAction = [UIAlertAction […]

如何在UIAlertController中添加textField?

我想实现一个关于更改密码的function,它需要用户input他以前的密码,并且我devise了一个警报对话框,我想点击“确认修改”button,然后跳转到另一个视图控制器来更改密码。我已经写了一些代码,但是我不知道下一刻该怎么写。

如何在iOS9中更改UIAlertControllerbutton的文本颜色?

问题类似于iOS 8 UIActivityViewController和UIAlertControllerbutton文本颜色使用窗口的tintColor,但在iOS 9。 我有一个UIAlertController和解雇button保持白色,即使我试图设置 [[UIView appearanceWhenContainedIn:[UIAlertController class], nil] setTintColor:[UIColor blackColor]]; UIAlertController *strongController = [UIAlertController alertControllerWithTitle:title message:message preferredStyle:preferredStyle]; strongController.view.tintColor = [UIColor black];

UIAlertController如果iOS 8,否则UIAlertView

我想符合iOS 8中使用的UIAlertController,因为UIAlertView现在已经被弃用了。 有没有一种方法,我可以使用这个没有打破支持iOS 7? 是否有某种条件,我可以做检查iOS 8,否则做iOS 7支持的其他条件?

从AppDelegate呈现UIAlertController

我想在我的iOS应用程序中从AppDelegate展示一个UIAlertController 。 以下是警报和现在的方法。 UIAlertController *alert = [UIAlertController alertControllerWithTitle:cTitle message:cMessage preferredStyle:UIAlertControllerStyleAlert]; //Configure alert and actions [self.window.rootViewController presentViewController:alert animated:TRUE completion:nil]; 但是,当我尝试显示警报时,它不会显示,并在控制台中显示以下警报。 Warning: Attempt to present <UIAlertController: 0x145f5d60> on <UINavigationController: 0x146590f0> whose view is not in the window hierarchy! 什么是导致错误,我该如何解决?

在iOS应用程序处于后台时显示提醒

我想显示一个警报视图,当我的iOS应用程序在后台 (和它使用的位置)。 例如,即使在以下情况下, Uber合作伙伴(驱动程序)应用程序也会显示警报并播放声音: 我已closures通知! 我的iPhone处于静音模式! 我知道本地通知方式,如果用户closures/更改设置中的通知不起作用。 我正在寻找不同的东西。 为达到上述状态而采取的行动: Uber合作伙伴应用程序上线(你是司机!) 在设置中禁用应用的通知 将应用程序移到后台并等待乘车请求 经过一段时间后,一个驾驶请求popup警报视图,并在后台播放声音 当然,即使用户在“设置”中禁用“通知”,使用didReceiveRemoteNotification: fetchCompletionHandler: API也可以通过应用程序轻敲静音远程通知。 但是,警报是如何popup的,这正是我想要find的。

检查UIAlertController是否已经呈现的最佳方法是什么?

我有一个tableview,加载时,每个单元格可能会返回一个NSError,我已经select显示在一个UIAlertController。 问题是我得到这个错误在控制台中,如果多个错误返回。 警告:尝试在MessagesMasterVC上显示UIAlertController:0x14e64cb00:0x14e53d800已经呈现(null) 理想情况下,我最好喜欢在我的UIAlertController扩展方法中处理这个。 class func simpleAlertWithMessage(message: String!) -> UIAlertController { let alertController = UIAlertController(title: nil, message: message, preferredStyle: UIAlertControllerStyle.Alert) let cancel = UIAlertAction(title: "Ok", style: .Cancel, handler: nil) alertController.addAction(cancel) return alertController } 基于马特的答案,我将扩展名更改为一个UIViewController扩展,它更干净,并节省了很多presentViewController代码。 func showSimpleAlertWithMessage(message: String!) { let alertController = UIAlertController(title: nil, message: message, preferredStyle: UIAlertControllerStyle.Alert) let cancel = UIAlertAction(title: "Ok", style: .Cancel, handler: […]

在8.3中更改iOS UIAlertController粗体button

UIAlertController带有两个样式设置的button: UIAlertActionStyle.Cancel UIAlertActionStyle.Default 在iOS 8.2中,取消button不是粗体,默认为粗体。 在iOS 8.3中,他们已经轮换了 你可以看到苹果自己的应用程序,例如设置>邮件>添加账户> iCloud>input无效数据,然后在8.3上显示: 不支持的Apple ID 了解更多(粗体)确定(非粗体) 而另一方面则是8.2。 任何解决方法,使它像8.2再次。 它为什么改变了?