UIImagePickerController *imagePicker = [[UIImagePickerController alloc] init];
imagePicker.delegate = self;
imagePicker.sourceType = UIImagePickerControllerSourceTypeCamera;//获取类型是摄像头,还可以是相册
imagePicker.modalTransitionStyle = UIModalTransitionStyleCoverVertical;
imagePicker.allowsEditing = NO;//如果为NO照出来的照片是原图,比如4s和5的iPhone出来的尺寸应该是(2000+)*(3000+),差不多800W像素,如果是YES会有个选择区域的方形方框
// imagePicker.showsCameraControls = NO;//默认是打开的这样才有拍照键,前后摄像头切换的控制,一半设置为NO的时候用于自定义ovelay
// UIImageView *overLayImg = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 320, 640)];
// overLayImg.image = [UIImage imageNamed:@"overlay.png"];
// imagePicker.cameraOverlayView = overLayImg;//3.0以后可以直接设置cameraOverlayView为overlay
// imagePicker.wantsFullScreenLayout = YES;
[self presentModalViewController:imagePicker animated:YES];
iOS - 自定义相机取景框
最新推荐文章于 2017-11-18 09:39:12 发布