我将此代码放入两个项目中。在一个项目中,我只需按下拍照按钮即可拍照。在另一个项目中,我必须长按按钮才能拍照。请帮帮我。
UIImagePickerController *picker = [[UIImagePickerController alloc] init];
picker.delegate = self;
picker.sourceType = UIImagePickerControllerSourceTypeCamera;
[self presentViewController:picker animated:YES completion:NULL];
答案 0 :(得分:0)
这对我来说非常有用..
var imagePicker: UIImagePickerController! = UIImagePickerController()
@IBAction func takepic(sender: AnyObject) {
imagePicker = UIImagePickerController()
imagePicker.delegate = self
imagePicker.sourceType = .Camera
imagePicker.cameraCaptureMode = .Photo
imagePicker.cameraDevice = .Front;
presentViewController(imagePicker, animated: true, completion: nil)
}