草庐IT

AlertController

全部标签

ios - UIPopover 如何使用这样的按钮制作弹出窗口?

我想知道如何使用这样的按钮创建弹出框。回答:UIActionSheet*actionSheet=[[UIActionSheetalloc]initWithTitle:nildelegate:selfcancelButtonTitle:nildestructiveButtonTitle:nilotherButtonTitles:@"TakePhoto",@"ChooseExistingPhoto",nil];[actionSheetshowFromRect:button.frameinView:button.superviewanimated:YES];委托(delegate)对象类中的

ios - UIPopover 如何使用这样的按钮制作弹出窗口?

我想知道如何使用这样的按钮创建弹出框。回答:UIActionSheet*actionSheet=[[UIActionSheetalloc]initWithTitle:nildelegate:selfcancelButtonTitle:nildestructiveButtonTitle:nilotherButtonTitles:@"TakePhoto",@"ChooseExistingPhoto",nil];[actionSheetshowFromRect:button.frameinView:button.superviewanimated:YES];委托(delegate)对象类中的

ios - 如何从 appDelegate 呈现 UIAlertView

我正在尝试从appDelegate中显示一个UIAlertViewdidReceiveRemoteNotification当应用收到推送通知时。我有这个错误:Warning:Attempttopresentonwhoseviewisnotinthewindowhierarchy!这是我的代码:funcapplication(application:UIApplication,didReceiveRemoteNotificationuserInfo:NSDictionary){varcontentPush:NSDictionary=userInfo.objectForKey("aps")

ios - 如何从 appDelegate 呈现 UIAlertView

我正在尝试从appDelegate中显示一个UIAlertViewdidReceiveRemoteNotification当应用收到推送通知时。我有这个错误:Warning:Attempttopresentonwhoseviewisnotinthewindowhierarchy!这是我的代码:funcapplication(application:UIApplication,didReceiveRemoteNotificationuserInfo:NSDictionary){varcontentPush:NSDictionary=userInfo.objectForKey("aps")

Swift:插入带文本输入的警告框(和存储文本输入)

在我的一个viewController中,我想让一个alertbox出现,提示user键入此信息。然后,我希望用户使用NSUserDefaults存储此输入。我怎样才能做到这一点?提前致谢! 最佳答案 检查一下:letalertController=UIAlertController(title:"Email?",message:"Pleaseinputyouremail:",preferredStyle:.alert)letconfirmAction=UIAlertAction(title:"Confirm",style:.def

Swift:插入带文本输入的警告框(和存储文本输入)

在我的一个viewController中,我想让一个alertbox出现,提示user键入此信息。然后,我希望用户使用NSUserDefaults存储此输入。我怎样才能做到这一点?提前致谢! 最佳答案 检查一下:letalertController=UIAlertController(title:"Email?",message:"Pleaseinputyouremail:",preferredStyle:.alert)letconfirmAction=UIAlertAction(title:"Confirm",style:.def

ios - 如何使用 Swift iOS 向 UIAlertView 按钮添加操作

我想添加另一个按钮,而不是“确定”按钮,它应该只是解除警报。我想让另一个按钮调用某个函数。varlogInErrorAlert:UIAlertView=UIAlertView()logInErrorAlert.title="Ooops"logInErrorAlert.message="Unabletologin."logInErrorAlert.addButtonWithTitle("Ok")我如何向此警报添加另一个按钮,然后允许它在单击后调用一个函数,假设我们希望新按钮调用:retry() 最佳答案 Swifty的方法是使用新的U

ios - 如何使用 Swift iOS 向 UIAlertView 按钮添加操作

我想添加另一个按钮,而不是“确定”按钮,它应该只是解除警报。我想让另一个按钮调用某个函数。varlogInErrorAlert:UIAlertView=UIAlertView()logInErrorAlert.title="Ooops"logInErrorAlert.message="Unabletologin."logInErrorAlert.addButtonWithTitle("Ok")我如何向此警报添加另一个按钮,然后允许它在单击后调用一个函数,假设我们希望新按钮调用:retry() 最佳答案 Swifty的方法是使用新的U

ios - 当出现 actionSheet (AlertController) 时,如何修复 PopoverViewController 的边界?

当ViewController通过UIPopoverPresentationController以iOS8的方式呈现actionSheet(AlertController)时,ViewController将其边界缩小到actionSheet的大小。我试图做的是在弹出窗口上显示actionSheet,但我以iOS8的方式进行,我遇到了这种奇怪的情况。这就是我遇到这种情况的原因当按下barButtonItem时,它通过UIPopoverPresentationController弹出ViewController。(如图1)当按下ViewController上的按钮时,它会显示一个actio

ios - 停止任务直到 AlertController Action 发生 Swift

我尝试从present的completion参数执行一个任务,这样它只会在UIAlertController关闭后执行所需的功能。但是,在警报中采取操作之前调用了该函数。我如何等待执行功能直到采取行动?letalert=UIAlertController(title:"WildCardPlayed",message:"Chooseyoursuit",preferredStyle:.alert);forsuitinsuits{alert.addAction(UIAlertAction(title:suit,style:.default,handler:crazyEightPlayed))