I use standart image picker to make some camera photo.
我使用标准图像选择器来制作一些相机照片。
When user makes photo image picker shows him the Preview screen with 2 buttons "Retake" and "Use".
当用户进行图片选择时,会显示预览屏幕,其中有两个按钮“重拍”和“使用”。
How to detect that Preview screen is active now or "Retake" button pressed? Is it possible ? Are the useful properties or events? Something like when image source is library the is property - allows editing, which shows similar screen .
如何检测预览屏幕现在是活动的还是按下“重取”按钮?是可能的吗?是有用的属性还是事件?类似于当图像源是库时的is属性——允许编辑,显示类似的屏幕。
UIImagePickerController * imagePicker = [[UIImagePickerController alloc] init];
imagePicker.delegate = self;
imagePicker.sourceType = UIImagePickerControllerSourceTypeCamera;
2 个解决方案
#1
0
A bit after the fact, but maybe someone is still seeking this answer like I was. If you want continue using the native camera controls, you can check the subviews of the ImagePickerController to determine if the post-record view is showing.
在事实发生后不久,也许有人还像我一样在寻找这个答案。如果您想继续使用本机相机控件,可以检查ImagePickerController的子视图,以确定后记录视图是否显示。
BOOL videoTaken = NO;
for (UIView *aView in self.imagePickerController.view.subviews[0].subviews[0].subviews[0].subviews)
{
if ([aView isKindOfClass:NSClassFromString(@"PLTileContainerView")])
{
videoTaken = YES;
break;
}
}
The "PLTileContainerView" is the subview that contains the editing slider that lets you view your video frame by frame, so if it's present, that means your video has already recorded.
“PLTileContainerView”是包含编辑滑块的子视图,它允许你逐帧查看你的视频帧,所以如果它存在,那意味着你的视频已经录制好了。
#2
-2
For use:
使用:
- (void) imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
{
[picker dismissModalViewControllerAnimated:NO];
NSString *type = [info objectForKey:@"UIImagePickerControllerMediaType"];
if ([type isEqualToString:@"public.movie"]) {
} else {
UIImage *image = [info objectForKey:@"UIImagePickerControllerOriginalImage"];
}
}
For Cancel you don't have a way of detecting it (other than subclassing UIImagePickerController
, which may be prohibited, or other way that I'm not aware), but for sure the second cancel is detectable :
对于Cancel,你没有检测它的方法(除了子类化UIImagePickerController,这可能是被禁止的,或者其他我不知道的方式),但是可以肯定的是第二个取消是可以检测到的:
- (void)imagePickerControllerDidCancel:(UIImagePickerController *)picker {
[picker dismissModalViewControllerAnimated:YES];
}
#1
0
A bit after the fact, but maybe someone is still seeking this answer like I was. If you want continue using the native camera controls, you can check the subviews of the ImagePickerController to determine if the post-record view is showing.
在事实发生后不久,也许有人还像我一样在寻找这个答案。如果您想继续使用本机相机控件,可以检查ImagePickerController的子视图,以确定后记录视图是否显示。
BOOL videoTaken = NO;
for (UIView *aView in self.imagePickerController.view.subviews[0].subviews[0].subviews[0].subviews)
{
if ([aView isKindOfClass:NSClassFromString(@"PLTileContainerView")])
{
videoTaken = YES;
break;
}
}
The "PLTileContainerView" is the subview that contains the editing slider that lets you view your video frame by frame, so if it's present, that means your video has already recorded.
“PLTileContainerView”是包含编辑滑块的子视图,它允许你逐帧查看你的视频帧,所以如果它存在,那意味着你的视频已经录制好了。
#2
-2
For use:
使用:
- (void) imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
{
[picker dismissModalViewControllerAnimated:NO];
NSString *type = [info objectForKey:@"UIImagePickerControllerMediaType"];
if ([type isEqualToString:@"public.movie"]) {
} else {
UIImage *image = [info objectForKey:@"UIImagePickerControllerOriginalImage"];
}
}
For Cancel you don't have a way of detecting it (other than subclassing UIImagePickerController
, which may be prohibited, or other way that I'm not aware), but for sure the second cancel is detectable :
对于Cancel,你没有检测它的方法(除了子类化UIImagePickerController,这可能是被禁止的,或者其他我不知道的方式),但是可以肯定的是第二个取消是可以检测到的:
- (void)imagePickerControllerDidCancel:(UIImagePickerController *)picker {
[picker dismissModalViewControllerAnimated:YES];
}