隐藏/显示 iPhone 相机光圈/快门动画 [英] Hide/Show iPhone Camera Iris/Shutter animation

查看:31
本文介绍了隐藏/显示 iPhone 相机光圈/快门动画的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我无法为我的应用隐藏 iphone 相机快门打开动画.我正在使用 UIImagePickerController 访问 iphone 相机并使用我自己的覆盖控制器.有没有办法在相机启动时移除初始快门(也称为光圈)动画.谢谢你

I am not able to Hide the iphone Camera shutter opening animation for my app. I am using UIImagePickerController to access iphone camera and using my own overlay controllers. Is there a way to remove the initial shutter(also known as Iris) animation as the camera starts. Thank You

对于那些想知道如何改变相机光圈动画的人.

For those who wants to know the way to change the camera iris animation.

在相机光圈动画开始之前调用下面的函数.

The below function is called before the camera iris animation starts.

- (void)navigationController:(UINavigationController *)navigationController willShowViewController:(UIViewController *)viewController animated:(BOOL)animated
{
    // Here is were I make the camera preview fit the entire screen. 
    // This might violate the "don't change the view hierarchy"-rule. 
    // So I am not sure if it is valid for App Store commitment.
    // However, the NSLogs are used to
    // figure out which subview is the actual Camera Preview which turns out 
    // to be the PLPreviewView. (uncomment to se the printouts).
    // Change it's size to fit the entire screen (and scale it accordingly
    // to avoid distorted image

    NSLog(@"WillShowViewController called...");

    NSLog(@"VC:view:subviews
 %@

", [[viewController view] subviews]);

    NSLog(@"VC:view:PLCameraView:subviews
 %@

", [[[[viewController view] subviews] objectAtIndex: 0] subviews]);

    NSLog(@"VC:view:PLCameraView:PLPreviewView:subviews
 %@

", [[[[[[viewController view] subviews] objectAtIndex: 0] subviews] objectAtIndex: 0] subviews]);
    NSLog(@"VC:view:PLCameraView:PLCropOverLay:subviews
 %@

", [[[[[[viewController view] subviews] objectAtIndex: 0] subviews] objectAtIndex: 1] subviews]);
    NSLog(@"VC:view:PLCameraView:UIImageView:subviews
 %@

", [[[[[[viewController view] subviews] objectAtIndex: 0] subviews] objectAtIndex: 2] subviews]);

}

在上述函数中,您可以使用普通的 NSMuatableArray 语法(如 objectAtIndex)遍历每一层

In the above function you can go through each layer by using the normal NSMuatableArray syntax like objectAtIndex

希望这对你有帮助.

问候,

安库尔

推荐答案

使用 这个答案作为起点,我终于解决了这个问题:

Using this answer as a starting point, I've finally solved this problem:

注意:这显然不符合 3.3.1.

  1. 在您的 UIImagePickerController 上监听 UINavigationControllerDidShowViewControllerNotification,并在全局范围内监听 PLCameraViewIrisAnimationDidEndNotification.

  1. Listen for the UINavigationControllerDidShowViewControllerNotification on your UIImagePickerController, and the PLCameraViewIrisAnimationDidEndNotification globally.

遍历视图层次结构(从主 UIWindow 开始)寻找 PLCameraView.将视图的索引保存在主 UIWindow 中,因为您稍后会需要它.

Traverse the view hierarchy (starting at the main UIWindow) looking for the PLCameraView. Save the index of the view against the main UIWindow, as you'll need it later.

superView 中移除 PLCameraView.如果需要,在全局索引 0 处插入您自己的视图.

Remove the PLCameraView from its superView. If desired, insert your own view at global index 0.

虹膜动画完成后,移除视图并在其原始索引处重新添加 PLCameraView.

When the iris animation is finished, remove your view and re-add the PLCameraView at its original index.

这篇关于隐藏/显示 iPhone 相机光圈/快门动画的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆