iOS 9,Swift 2.1-删除垂直布局中的警报
我有一个普通风格的警告,显示了2个按钮水平与以下实现,我想知道我如何才能使它像附加的图像iOS 9,Swift 2.1-删除垂直布局中的警报,ios,swift,Ios,Swift,我有一个普通风格的警告,显示了2个按钮水平与以下实现,我想知道我如何才能使它像附加的图像 let alert = UIAlertController(title: "", message: "This item will be deleted", preferredStyle: .Alert) alert.addAction(UIAlertAction(title: "Cancel", style: UIAlertActionStyle.Cancel, handler: nil)); alert
let alert = UIAlertController(title: "", message: "This item will be deleted", preferredStyle: .Alert)
alert.addAction(UIAlertAction(title: "Cancel", style: UIAlertActionStyle.Cancel, handler: nil));
alert.addAction(UIAlertAction(title: "Delete", style: UIAlertActionStyle.Destructive, handler: {
alertAction in
self.deleteItem(sender)
}))
presentViewController(alert, animated: true, completion: nil);
使用这个:-
let alert = UIAlertController(title: "", message: "This item will be deleted", preferredStyle: .ActionSheet)
使用这个:-
let alert = UIAlertController(title: "", message: "This item will be deleted", preferredStyle: .ActionSheet)
您可以将以下内容用于您想要实现的目标
@IBAction func actionRecommend(sender: UIButton) {
let optionMenu = UIAlertController(title: nil, message: "Recommend Using", preferredStyle: .ActionSheet)
optionMenu.view.tintColor = primaryDarkColor
let deleteAction = UIAlertAction(title: "Facebook", style: .Default, handler: {
(alert: UIAlertAction!) -> Void in
print("File Facebook")
})
let saveAction = UIAlertAction(title: "Contacts", style: .Default, handler: {
(alert: UIAlertAction!) -> Void in
print("File toContacts")
// self.performSegueWithIdentifier("toContacts", sender: nil)
})
let cancelAction = UIAlertAction(title: "Cancel", style: .Cancel, handler: {
(alert: UIAlertAction!) -> Void in
print("Cancelled")
})
optionMenu.addAction(deleteAction)
optionMenu.addAction(saveAction)
optionMenu.addAction(cancelAction)
self.presentViewController(optionMenu, animated: true, completion: nil)
}
您可以将以下内容用于您想要实现的目标
@IBAction func actionRecommend(sender: UIButton) {
let optionMenu = UIAlertController(title: nil, message: "Recommend Using", preferredStyle: .ActionSheet)
optionMenu.view.tintColor = primaryDarkColor
let deleteAction = UIAlertAction(title: "Facebook", style: .Default, handler: {
(alert: UIAlertAction!) -> Void in
print("File Facebook")
})
let saveAction = UIAlertAction(title: "Contacts", style: .Default, handler: {
(alert: UIAlertAction!) -> Void in
print("File toContacts")
// self.performSegueWithIdentifier("toContacts", sender: nil)
})
let cancelAction = UIAlertAction(title: "Cancel", style: .Cancel, handler: {
(alert: UIAlertAction!) -> Void in
print("Cancelled")
})
optionMenu.addAction(deleteAction)
optionMenu.addAction(saveAction)
optionMenu.addAction(cancelAction)
self.presentViewController(optionMenu, animated: true, completion: nil)
}
更改preferredStyle:。代码中的ActionSheet.is您的问题解决方案更改preferredStyle:。代码中的ActionSheet.is您的问题解决方案我没想到会这么简单。。不错!给我几分钟,直到它允许我:)我没想到它会这么简单。。不错!给我几分钟,直到它允许我:)