草庐IT

UIAlertcontroller

全部标签

ios - 呈现 UIAlertController 时应用程序崩溃

这个问题在这里已经有了答案:SwiftUIAlertController->ActionSheetiPadiOS8Crashes(8个答案)关闭5年前。我的应用程序在尝试显示UIAlertController时崩溃。我有一个以模态方式呈现的UIViewController,然后在该呈现的ViewController上,当点击某个按钮时,我想呈现一个actionSheet警报。执行此操作时应用程序以某种方式崩溃,我无法弄清楚原因。代码如下:letalertController=UIAlertController(title:nil,message:nil,preferredStyle:.

swift - Xcode Swift 如何将图像添加到 UIAlertController 选项?

这个问题在这里已经有了答案:AddImagetoUIAlertActioninUIAlertController(8个答案)关闭4年前。我想将图像/图标添加到UIAlertController就像苹果音乐播放器中的对话框一样我想要像下图一样的彩色/大小图像/图标,而不是里面的thisquestion.我相信它的ios11+功能,但我找不到它的文档。就像这样:我可以在UIAlertController中执行此操作,还是我应该创建自己的自定义对话框uiviewcontroller?

ios - 如何在用户单击“确定”时显示 UIAlertController 并执行操作?

我受困于UIAlertController。我有这个警报View:@IBActionfuncAddPatientButton(sender:AnyObject){letalert=UIAlertController(title:"RegistroPaciente",message:"PacienteRegistrado",preferredStyle:UIAlertControllerStyle.Alert)alert.addAction(UIAlertAction(title:"Ok",style:UIAlertActionStyle.Default,handler:nil))sel

ios - UITableView 中带有警报的奇怪延迟

我有一些UITableView,其中包含来自内部array的数据。我想在点击时显示UIAlertController,但我遇到了非常奇怪的延迟。functableView(_tableView:UITableView,didSelectRowAtindexPath:IndexPath){print("tapped\(dispatcher.conversations[indexPath.row].name)")//thisoneworksfine,noproblemshereletmessage=dispatcher.conversations[indexPath.row].desc+"

iOS模态叠加菜单

我想知道XCode中是否有一个内置View来为iOS应用程序显示像这样的弹出菜单?类似于警报,只是只有一组垂直堆叠的按钮?编辑:我知道UIAlertController,只是不知道它的按钮在添加超过2个后垂直堆叠,这正是我想要的样式。只是为了清除,将按钮的标题和消息也设置为nil。 最佳答案 是的。它叫做UIAlertController 关于iOS模态叠加菜单,我们在StackOverflow上找到一个类似的问题: https://stackoverflow

ios - 如何在 swift ios 中创建自定义 UIAlertController?

我正在尝试制作如下所示的UIAlertController:我们如何自定义UIAlertController以获得与此图片相同的结果? 最佳答案 您尝试做的是弹出窗口,对于当前版本的iOS,您可以在iPad和iPhone上实现相同的效果。1.-首先在Storyboard或xib上构建您的设计。然后引用它。2.-然后将其呈现为弹出窗口。3.-也许您会想要实现popoverdelegates以避免旋转设备时位置错误。例如:privatestaticfuncpresentCustomDialog(parent:UIViewControll

swift - UIAlertController 消息被截断为一行

在我的应用程序中,在呈现UIAlertController时,它会将消息截断为一行。如何使其显示为自动换行显示全文。这是我的代码letalert=UIAlertController(title:title,message:"Longtext",preferredStyle:UIAlertControllerStyle.alert)letokAction=UIAlertAction(title:"OK",style:UIAlertActionStyle.default,handler:nil)alert.addAction(okAction)self.present(alert,anim

ios - UIAlertAction 按钮文本左对齐

我想将UIAlertAction文本对齐方式向左对齐,并添加如图所示的图标。我花了很多时间在谷歌上寻找解决方案,但没有找到正确的答案。警报标题的每个正文帖子都不是警报操作标题。请给我建议swift的正确方法。谢谢!! 最佳答案 您可以使用下面的示例代码来做到这一点。简单易行。swift4letactionSheetAlertController:UIAlertController=UIAlertController(title:nil,message:nil,preferredStyle:.actionSheet)letcancel

ios - 如何创建可重用的 UIAlertcontroller?

我想为我的项目创建一个可重用的UIAlertController类。我尝试了以下代码。但我的警报没有显示。我的代码或任何代码帮助有什么问题。这是我的警报类classAlertView:NSObject{classfuncshowAlert(view:UIViewController,message:String){letalert=UIAlertController(title:"Warning",message:message,preferredStyle:UIAlertControllerStyle.Alert)alert.addAction(UIAlertAction(title

ios - 如何消除 UIAlertController 的延迟?

点击表格单元格后,警报View显示有4到5秒的延迟。下面是代码functableView(_tableView:UITableView,didSelectRowAtindexPath:IndexPath){letcell=tableView.cellForRow(at:indexPath)!letalertController=UIAlertController(title:nil,message:nil,preferredStyle:.alert)letok=UIAlertAction(title:"Ok",style:.default,handler:{(action)->Void