我用不同的操作创建了 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, {})
])
警报项之间的分隔符不同。如何使它们相同?
最佳答案
据我从上图中所见,在工作表下你的背景不均匀,据我猜测它会在你声称不同的分隔线正上方改变颜色。所以看起来你的背景不一样。
关于ios - UIAlertController .actionSheet 项目之间的分隔线不一样,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56568821/