【发布时间】:2020-11-15 22:33:30
【问题描述】:
如何让用户在 UIImagePicker 中切换前置摄像头和后置摄像头?
-(void)takePhoto {
UIImagePickerController *imagePickerController = [[UIImagePickerController alloc] init];
#if TARGET_IPHONE_SIMULATOR
imagePickerController.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
#else
imagePickerController.sourceType = UIImagePickerControllerSourceTypeCamera;
#endif
imagePickerController.editing = YES;
imagePickerController.delegate = (id)self;
[self presentModalViewController:imagePickerController animated:YES];
}
【问题讨论】:
标签: ios objective-c cocoa-touch