lianlianbushell 2013-02-17 08:31 采纳率: 0%
浏览 884

关于在Uialertview中Uistepper的问题

怎么在UIAlertView中显示Uistepper?请高手指点一下,我需要在工程中用到。还有如何在弹出窗口中显示UIStepper

  • 写回答

1条回答 默认 最新

  • ChatGPTᴼᴾᴱᴺᴬᴵ 2022-12-19 14:22
    关注

    ChatGPT尝试为您解答
    在 iOS 13 及以后的版本中,UIAlertView 已经不再被支持。它被替换为了 UIAlertController 类。你可以使用 UIAlertController 来创建一个弹出窗口,并在其中添加 UIStepper 控件。


    你可以使用以下代码来创建一个包含 UIStepper 的 UIAlertController:

    let alertController = UIAlertController(title: "Title", message: "Message", preferredStyle: .alert)
    
    let stepper = UIStepper()
    stepper.minimumValue = 0
    stepper.maximumValue = 100
    stepper.stepValue = 1
    
    alertController.view.addSubview(stepper)
    
    let cancelAction = UIAlertAction(title: "Cancel", style: .cancel, handler: nil)
    alertController.addAction(cancelAction)
    
    let okAction = UIAlertAction(title: "OK", style: .default, handler: nil)
    alertController.addAction(okAction)
    
    present(alertController, animated: true, completion: nil)
    

    在这段代码中,我们首先创建了一个 UIAlertController 实例,然后创建了一个 UIStepper 实例,并设置了其最小值、最大值和步长。接着,我们将 UIStepper 添加到了 UIAlertController 的 view 中。最后,我们为 UIAlertController 添加了一个取消按钮和一个确定按钮,然后使用 present 方法显示弹出窗口。

    评论

报告相同问题?

悬赏问题

  • ¥15 如何在scanpy上做差异基因和通路富集?
  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 報錯:Person is not mapped,如何解決?
  • ¥15 c++头文件不能识别CDialog