swift3.0 底部弹出菜单 UIAlertController的使用

let optionMenuController = UIAlertController(title: nil, message: "选择图片", preferredStyle: .actionSheet)
        
        let libraryAction = UIAlertAction(title: "从相册选择", style: .default, handler: {
            (alert: UIAlertAction!) -> Void in
        })
        
        let cameraAction = UIAlertAction(title: "拍照", style: .default, handler: {
            (alert: UIAlertAction!) -> Void in
        })
        
        let cancelAction = UIAlertAction(title: "取消", style: .default, handler: {
            (alert: UIAlertAction!) -> Void in
        })
        
        optionMenuController.addAction(libraryAction)
        optionMenuController.addAction(cameraAction)
        optionMenuController.addAction(cancelAction)
        
        self.present(optionMenuController, animated: true, completion: nil)

  

posted @ 2017-04-27 19:32  昨天的李小白  阅读(999)  评论(0编辑  收藏  举报