通过自己的摸索,终于弄出来了……
class SelectViewController:UIViewController,UIImagePickerControllerDelegate,UINavigationControllerDelegate,UIActionSheetDelegate {
var myActionSheet:UIActionSheet?
var picker:UIImagePickerController?
overridefunc viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
}
@IBOutletweak var img:UIImageView!
@IBOutletweak var btn_select:UIButton!
overridefunc didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
//选取获取图片的方式
func openMenu()
{
myActionSheet =UIActionSheet(title: nil, delegate:self, cancelButtonTitle: "取消", destructiveButtonTitle:nil,otherButtonTitles:"打开相机","从相册选取")