UIAlertController .actionSheet 中各项之间的分隔线不同。

3

我创建了带有不同操作的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, {})
        ])

作为结果,我得到了这个 输入图像描述 警报项之间的分隔符不同。如何使它们相同?

你是在模拟器上运行吗?它是一个缩放的模拟器吗? - rmaddy
1个回答

1
据我所见,从上面的图像来看,在您的背景下方并不均匀,我猜测在您声称不同的分隔符上方,它会改变颜色。因此,看起来您的背景是不同的。

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接