a Swift 2.2, è possibile utilizzare il codice qui sotto e ho anche cambiato il colore del pulsante di azione signout
let actionSheet: UIAlertController = UIAlertController(title: nil, message: nil, preferredStyle: .ActionSheet)
self.presentViewController(actionSheet, animated: true, completion: nil)
let settingsActionButton: UIAlertAction = UIAlertAction(title: "Settings", style: .Cancel) { action -> Void in
print("Settings Tapped")
}
reportActionSheet.addAction(settingsActionButton)
let signOutActionButton: UIAlertAction = UIAlertAction(title: "Signout", style: .Default)
{ action -> Void in
//Clear All Method
print("Signout Tapped")
}
signOutActionButton.setValue(UIColor.redColor(), forKey: "titleTextColor")
actionSheet.addAction(signOutActionButton)
let cancelActionButton: UIAlertAction = UIAlertAction(title: "Cancel", style: .Cancel) { action -> Void in
print("Cancel Tapped")
}
reportActionSheet.addAction(cancelActionButton)
fonte
2017-04-17 06:29:53
Era piuttosto semplice. E questo ha risposto alla mia domanda. Grazie – vlin