小编Yu *_*Win的帖子

UIActionSheet iOS Swift

如何在iOS Swift中执行UIActionSheet?这是我编码UIActionSheet的代码.

@IBAction func downloadSheet(sender: AnyObject)
{
    let optionMenu = UIAlertController(title: nil, message: "Choose Option", preferredStyle: .actionSheet) 

    let saveAction = UIAlertAction(title: "Save", style: .default, handler: 
    {
        (alert: UIAlertAction!) -> Void in
        println("Saved")
    })

    let deleteAction = UIAlertAction(title: "Delete", style: .default, handler:
    {
        (alert: UIAlertAction!) -> Void in
        println("Deleted")
    })

    let cancelAction = UIAlertAction(title: "Cancel", style: .cancel, handler: 
    {
        (alert: UIAlertAction!) -> Void in
        println("Cancelled")
    })
    optionMenu.addAction(deleteAction)
    optionMenu.addAction(saveAction)
    optionMenu.addAction(cancelAction)
    self.presentViewController(optionMenu, animated: true, completion: nil)
}
Run Code Online (Sandbox Code Playgroud)

我希望我的代码清楚......我欢迎对此代码提出更好的建议.

uiactionsheet ios swift

89
推荐指数
8
解决办法
9万
查看次数

标签 统计

ios ×1

swift ×1

uiactionsheet ×1