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

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

问题描述

我无法为我的应用程式隐藏iPhone相机快门开启动画。
我使用UIImagePickerController访问iphone摄像头和使用我自己的覆盖控制器。
有一种方法可以在相机启动时删除初始快门(也称为Iris)动画。
谢谢





对于那些想知道如何更改



以下函数在相机光圈动画开始之前调用。

   - (void)navigationController:(UINavigationController *)navigationController willShowViewController:(UIViewController *)viewController animated:(BOOL)animated 
{
//这是我让相机预览适合整个屏幕。
//这可能违反不更改视图层次结构-rule。
//所以我不知道它是否对App Store的承诺有效。
//然而,NSLogs用于
//找出哪个子视图是实际的相机预览,结果是
//成为PLPreviewView。 (取消注释以打印输出)。
//改变它的大小以适应整个屏幕(并相应地缩放
//以避免失真的图像

NSLog(@WillShowViewController called ...);

NSLog(@VC:view:subviews \\\
%@ \\\
\\\
,[[viewController view] subviews]);

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

NSLog :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] ;
NSLog(@VC:view:PLCameraView:UIImageView:subviews\ n%@ \\\
\\\
,[[[[[viewController view] subviews] objectAtIndex:0] subviews] objectAtIndex: 2] subviews]);

}

通过使用正常的NSMuatableArray语法像objectAtIndex



来遍历每一层。希望这可能会帮助你。





Ankur

解决方案

使用这个回答作为起点,我终于解决了这个问题: / p>

注意:这显然不符合3.3.1标准。


  1. UIImagePickerController 上聆听 UINavigationControllerDidShowViewControllerNotification ,并且全局。


  2. 遍历视图层次结构(从 UIWindow )寻找 PLCameraView 。将视图的索引保存到主<< c $ c> UIWindow 下的

  3. superView 中删除​​ PLCameraView


  4. 当iris动画完成后,删除您的视图,然后重新添加 PLCameraView 在其原始索引。



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

[EDIT]

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\n %@\n\n", [[viewController view] subviews]);

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

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

}

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

hope this might help you.

Regards,

Ankur

解决方案

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

NOTE: This is obviously not 3.3.1-compliant.

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

  2. 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.

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

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

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

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