ios - UIAlertController .actionSheet 项目之间的分隔线不一样

标签 ios swift user-interface

我用不同的操作创建了 UIAlertController。 这是代码:

typealias OptionMenuItem = (title: String, style: UIAlertAction.Style, handler: () -> Void)
@discardableResult func showOptionsAlert(items: [OptionMenuItem]) -> UIAlertController {
        let alertController = UIAlertController(title: nil, message: nil,
                preferredStyle: UIAlertController.Style.actionSheet)

        items.forEach({it in
            alertController.addAction(UIAlertAction(title: it.title, style: it.style, handler: {_ in
                it.handler()
            }))
        })

        present(alertController, animated: true, completion: nil)
        return alertController
    }


showOptionsAlert(items: [
            ("Copy Link", .default, {}),
            ("Turn On Post Notifications", .default, {}),
            ("Report", .destructive, {}),
            ("Mute", .destructive, {}),
            ("Unfollow", .destructive, {}),
            ("Cancel", .cancel, {})
        ])

结果我得到了这个 enter image description here

警报项之间的分隔符不同。如何使它们相同?

最佳答案

据我从上图中所见,在工作表下你的背景不均匀,据我猜测它会在你声称不同的分隔线正上方改变颜色。所以看起来你的背景不一样。

关于ios - UIAlertController .actionSheet 项目之间的分隔线不一样,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56568821/

相关文章:

arrays - 上下文类型 'Any' 不能与字典文字 Swift 一起使用

ios - iPhone sleep 时无法检测到 Beacon 设备。(进入后台)

arrays - 如何在 swift 中实例化一个 Array 类?

ios - NavigationItem 按钮和 Edit mode 按钮分层次显示

ios - 当我按下运行程序时,我的游戏会加载但无法启动

button - Wix UI 如何将焦点从一个按钮控件更改为另一个?

swing - java中的"Events type"

java - 基于EJB架构的应用程序的HTTP和UI层面是什么技术?

ios - LLDB 中的简单宏?

ios - 点击 UICollectionView 时更改单元格颜色