获取相机(swift)

前端之家收集整理的这篇文章主要介绍了获取相机(swift)前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

获取相机(swift)

by 伍雪颖

@H_404_5@

@IBAction func takePhoto(sender: AnyObject ) {@H_404_5@ view . endEditing ( true )@H_404_5@ moveViewDown ()@H_404_5@ @H_404_5@ let imagePickerActionSheet = UIAlertController (title: "Snap/Upload Photo" ,@H_404_5@ message: nil ,preferredStyle: . ActionSheet )@H_404_5@ @H_404_5@ if UIImagePickerController . isSourceTypeAvailable (. Camera ) {@H_404_5@ let cameraButton = UIAlertAction (title: "Take Photo" ,@H_404_5@ style: . Default ) { (alert) -> Void in @H_404_5@ let imagePicker = UIImagePickerController ()@H_404_5@ imagePicker. delegate = self @H_404_5@ imagePicker. sourceType = . Camera @H_404_5@ self . presentViewController (imagePicker,@H_404_5@ animated: true ,@H_404_5@ completion: nil )@H_404_5@ }@H_404_5@ imagePickerActionSheet. addAction (cameraButton)@H_404_5@ }@H_404_5@ @H_404_5@ let libraryButton = "Choose Existing" ,129)">PhotoLibrary @H_404_5@ addAction (libraryButton)@H_404_5@ @H_404_5@ let cancelButton = "Cancel" ,129)">Cancel ) { (alert) -> in @H_404_5@ }@H_404_5@ imagePickerActionSheet. addAction (cancelButton)@H_404_5@ @H_404_5@ presentViewController (imagePickerActionSheet,animated: nil )
}

猜你在找的Swift相关文章