请任何人帮助使用 swift 语言使用 xcode6 以编程方式创建操作表控制器。
问问题
3778 次
1 回答
7
这个问题似乎太笼统了。
也许您可以参考我如何在 Swift 中创建 UIAlertView?
这可能会帮助您入门。
使用 swift 呈现 UIActionSheet 的典型代码可能如下所示:
var myActionSheet = UIAlertController(title: "Delete all data ?", message: "You may not be able to recover this back", preferredStyle: UIAlertControllerStyle.ActionSheet)
myActionSheet.addAction(UIAlertAction(title: "Cancel", style: UIAlertActionStyle.Cancel, handler: nil))
myActionSheet.addAction(UIAlertAction(title: "Delete", style: UIAlertActionStyle.Default, handler: { (ACTION :UIAlertAction!)in
println("Deleting the data...")
}))
myActionSheet.addAction(UIAlertAction(title: "Delete Permanently", style: UIAlertActionStyle.Destructive, handler: { (ACTION :UIAlertAction!)in
println("Deleting data permanently...")
}))
self.presentViewController(myActionSheet, animated: true, completion: nil)
于 2014-06-06T14:37:18.180 回答