iOS - 自定義相機取景框

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];