I am trying to achieve the view with a few green actions, and get the selected action to be bold in UIAlertController. And one of the actions, which is dismiss button has to be divided from others and be colored with red.
I am trying to add them with the styles .cancel allows to show dismiss button, but it is bold, but green. How do I achieve this?
expected view:
my current code:
let alertController
= UIAlertController(title: nil,
message: nil,
preferredStyle: .actionSheet)
let sortByDateAction = UIAlertAction(title: "По дате",
style: .default,
handler: {(action: UIAlertAction!) in
if self.sortBy != "date" {
self.page = 1
self.sortBy = "date"
self.loadTenders()
}
})
let moreExpensiveSortAction = UIAlertAction(title: "Дороже",
style: .destructive,
handler: {(action: UIAlertAction!) in
if self.sortBy != "priceHigh" {
self.page = 1
self.sortBy = "priceHigh"
self.loadTenders()
}
})
let cheaperSortAction = UIAlertAction(title: "Дешевле",
style: .default,
handler: {(action: UIAlertAction!) in
if self.sortBy != "priceLow" {
self.page = 1
self.sortBy = "priceLow"
self.loadTenders()
}
})
alertController
.addAction(sortByDateAction)
alertController
.addAction(moreExpensiveSortAction)
alertController
.addAction(cheaperSortAction)
alertController.preferredAction = sortByDateAction
alertController
.addAction(UIAlertAction(title: "Dismiss",
style: .cancel,
handler: nil))