Tag: uialertcontroller

UIAlertController中的checkbox与目标c中的操作表

我想添加checkbox,即UIButton和Uilabel在UIAlertAction中的一个选项,只有在UIAlertController中的另一个UIAlertAction中的button。 请帮助和build议如何实现它。 UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"My Alert" message:@"This is an action sheet." preferredStyle:UIAlertControllerStyleActionSheet]; // 1 UIAlertAction *firstAction = [UIAlertAction actionWithTitle:@"one" style:UIAlertActionStyleDefault handler:^(UIAlertAction * action) { NSLog(@"You pressed button one"); }]; // 2 UIAlertAction *secondAction = [UIAlertAction actionWithTitle:@"two" style:UIAlertActionStyleDefault handler:^(UIAlertAction * action) { NSLog(@"You pressed button two"); }]; // 3 [alert addAction:firstAction]; // 4 [alert […]

如何在UIAlertController中添加UIImageView?

我想UIAlertController目前与ActionSheet中的UIImageView警报。 但是当我运行的应用程序,然后是终止…. 这是我的代码: UIAlertController * alert= [UIAlertController alertControllerWithTitle:@"Title" message:@"Welcome" preferredStyle:UIAlertControllerStyleAlert]; UIAlertAction* okButton = [UIAlertAction actionWithTitle:OK style:UIAlertActionStyleDefault handler:^(UIAlertAction * action) { }]; [alert addAction:okButton]; UIImageView *imgv=[[UIImageView alloc]initWithFrame:CGRectMake(20,20,50,50)]; imgv.image=[UIImage imageNamed:@"kaga.jpg"]; [alert setValue:imgv forKey:@"image"]; [self presentViewController:alert animated:YES completion:nil];

创buildUIAlertController而不显示它会产生警告

创buildUIAlertController而不显示它时,会在控制台中打印一条警告。 这是为什么? override func viewDidLoad() { super.viewDidLoad() let _ = UIAlertController(title: "title", message: "message", preferredStyle: .Alert) } 尝试加载视图控制器的视图时,它是释放是不允许的,并可能导致未定义的行为 编辑: 这个警告是否安全可以忽略? 如果UIAlertController已经创build好了,我决定不出示/使用它,我该怎么办?

UIAlertControllerbuttonfunction不起作用

let location = CLLocationCoordinate2D(latitude: 32.075300, longitude: 34.782563) @IBAction func DirectionsTolocationButton(_ sender: Any) { // Create the AlertController and add its actions like button in ActionSheet let ActionSheet = UIAlertController(title: "Please Select A Navigation Service.", message: nil, preferredStyle: .actionSheet) let AppleMapsButton = UIAlertAction(title: "Apple Maps", style: .default) { action -> Void in let destinationName = (self.barNameTemplate […]

在UIAlertController SWIFT中为每个图像添加一个animation图像

我有一个函数来显示一个UIAlertController。 在标题和文本下面,我想显示每个图像的animation图像。 我有13个图像循环。 func alertDownloadInProgress(text:String, sender:UIViewController) -> UIAlertController { var alert = UIAlertController(title: "Alert", message: text, preferredStyle: UIAlertControllerStyle.Alert) sender.presentViewController(alert, animated: true, completion: nil) return alert } 是否有可能使用UIAlertController或我必须完全自定义我的popup?

iOS推送通知自定义提醒

我试图在我的iOS应用程序中启用推送通知。 我想创build一个自定义提醒,询问用户是否要启用通知。 苹果允许这个/可能实现吗? 谢谢

如何在UIBarbutton中将UIAlertcontroller实现为PopOver(箭头方向向上)

我知道这是一个旧学校的问题 – 但我确实搜查了networking,发现解决scheme将被弃用。 我将如何实现一个UIAlertcontroller作为popOver(箭头方向向上)在barButton 。 代码如下: – (IBAction)eventSortingAction:(UIBarButtonItem *)sender { UIAlertController * view= [UIAlertController alertControllerWithTitle:@"My Title" message:@"Select you Choice" preferredStyle:UIAlertControllerStyleActionSheet]; UIAlertAction* ok = [UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleDefault handler:^(UIAlertAction * action) { //Do some thing here [view dismissViewControllerAnimated:YES completion:nil]; }]; UIAlertAction* cancel = [UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleCancel handler:^(UIAlertAction * action) { [view dismissViewControllerAnimated:YES completion:nil]; }]; [view addAction:ok]; [view […]

为什么alamofire下载警报的进度会闪烁,后面的屏幕开始变黑?

在使用alamofire下载时,我有警告的进度视图,但是问题是,当我想要下载alert时的进度视图将会开始完成,但闪烁,另一个问题是后面的屏幕将开始淡化为黑色每秒钟都会有一个新的提示,进度视图会显示,最后有很多提醒,我怎样才能避免它们? downloadTimer = Timer.scheduledTimer(timeInterval: 1 , target: self, selector: #selector(flashingDownload), userInfo: nil, repeats: true) let destination = DownloadRequest.suggestedDownloadDestination() Alamofire.download("http://example.com", to: destination).downloadProgress(queue: DispatchQueue.global(qos: .utility)) { (progress) in print("Progress: \(progress.fractionCompleted)") sixthLevelViewController.progressdownload = Float(progress.fractionCompleted) if sixthLevelViewController.progressdownload == 1.0 { self.downloadfinished = true let alertController = UIAlertController(title: "finish download ", message: " download Completed! ", preferredStyle: UIAlertControllerStyle.alert) let okAction […]

closures当前提供的所有UIAlertController

有没有办法解雇目前呈现的所有UIAlertControllers? 这是因为从任何地方和我的应用程序的任何状态,当按下推送通知时,我需要到某个ViewController。

iOS响应事件解除了UIAlertController

我有一个情况,我想呈现一个UIAlertController为了等待一个事件(从第三方数据asynchronous请求)完成显示我的主要ViewController的用户进行交互之前。 一旦asynchronous代码完成,那么我想closuresUIAlertController 。 我知道,通常UIAlertControllers设置了一个button来解除它,这是从用户input。 我想知道我想做什么(不考虑用户input的事件)是可能的? 到目前为止,我试图展示UIAlertController ,然后在while循环中等待事件发生时检查布尔值。 var alert = UIAlertController(title: "Please wait", message: "Retrieving data", preferredStyle: UIAlertControllerStyle.Alert) self.presentViewController(alert, animated: true, completion: nil) // dataLoadingDone is the boolean to check while (!dataLoadingDone) { } self.dismissViewControllerAnimated(true, completion: nil) 这给出了一个警告 警告:正在进行演示或解散时尝试从视图控制器中解散! 并且不closuresUIAlertController。 我也试过alert.dismissViewControllerAnimated(true, completion: nil)而不是self.dismissViewControllerAnimated(true, completion: nil) ,但是这并没有摆脱UIAlertController 。