English 中文(简体)
Hide/ShowOO Iris/Shutter animation
原标题:Hide/Show iPhone Camera Iris/Shutter animation

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]

对于那些想要知道改变照相管消.的方法的人来说。

以下功能在摄像机的消化开始之前即行。

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

}

在上述职能中,你可以通过使用普通的NSMuatable Array syntax等物体进入每一层。 AtIndex

希望这将有助于你。

关于

Ankur

问题回答

利用,作为起点回答

www.un.org/Depts/DGACM/index_spanish.htm 注: 这显然不符合3.3.1条。

  1. 参考<条码>的观点等级(从主要<条码>查询) PLCamera View。 Save the Index of the view against the main UIWindow/code>, as You ll need it subsequently.

  2. 删除。 如有必要,将自己的观点列入全球指数0。

  3. 当审案卷完成时,删除了你的观点,并重新填写了<代码>。 PLCamera View at its originalindex.

类似: 我想看到的是,当我把一个县引发的景象看上去时,一架UIImagePickerController的“UIImagePicker”号信就显示了这一点。 绕过这一页,进行了一些额外的研究,并找到了解决办法。

<>Synopsis:

@interface MyController : UIImagePickerController
...    
- (id) init {
...
    self.cameraOverlayView = _my_overlay_;
    self.showsCameraControls = NO;
...
}
... 
- (void) onMyShutterButton {
    [self takePicture]; 
        // You want the shutter animation to happen now.
        // .. but it does not.
}

<>Solution:

// Some constants for the iris view and selector
NSString* kIrisViewClassName = @"PLCameraIrisAnimationView";
SEL kIrisSelector = NSSelectorFromString(@"animateIrisOpen");

@implementation MyController {
...
    UIView* iris_;
}
- (void) viewDidAppear:(BOOL)animated {
    [super viewDidAppear:animated];
    // Find the iris view in the siblings of your overlay view
    for (UIView* view in self.cameraOverlayView.superview.subviews) {
        if ([kIrisViewClassName isEqualToString:[[view class] description]]) {
            // It will be hidden by  self.showsCameraControls = NO .
            view.hidden = false;   
            // Extra precautions - as this is undocumented.  
            if ([view respondsToSelector:kIrisSelector]) {
                iris_ = view;
            }
            break;
        }
    }
}
- (void) animateIrisOpen {
    if (iris_) {
        [iris_ performSelector:kIrisSelector];
    }
}
...
- (void) onMyShutterButton {
    [self takePicture]; 
    [self animateIrisOpen];   // Voila - the shutter happens
}

我用这个比喻敲响,但向图像采集者发送了各种观察生命周期方法。 (view WillAppear, viewDidAppear, 等) 但是,我不记得哪些人结束了工作。

答辩迟缓。 我发现,我为了照相机的等级而 around熟地这样做,我找到了解决办法。 观点和增加我自己的一层。 在那里进行了估算,一旦关闭者打开了最顶层,就会拆除。 如果有人需要进一步帮助,请让我知道,我将提供确切的步骤和综合。

- 空白

Joshwa的回答完全掩盖了全照相在轮胎消亡期间的看法。 为了我的目的,我需要看到摄像机,而不用静脉注射。 我能够以他的方法稍微动摇的方式做到这一点。 正如其他人指出的,由于我们重述了观点等级,并倾听了无证通知,这也许或不可能在仓库中允许。

需要3平方米:

UIImagePickerController *imagePickerController;
UIView *plCameraIrisAnimationView;  // view that animates the opening/closing of the iris
UIImageView *cameraIrisImageView;  // static image of the closed iris

image清封闭的里面形象,消除 an感。 我只试图掩盖悲观的观点,但 an感仍然明显:

- (void)receivedNavigationControllerDidShowViewControllerNotification:(NSNotification *)notification {
    UIView *view = imagePickerController.view;
    [plCameraIrisAnimationView release];
    plCameraIrisAnimationView = nil;
    cameraIrisImageView = nil;
    while (view.subviews.count && (view = [view.subviews objectAtIndex:0])) {
        if ([[[view class] description] isEqualToString:@"PLCameraView"]) {
            for (UIView *subview in view.subviews) {
                if ([subview isKindOfClass:[UIImageView class]]) {
                    cameraIrisImageView = (UIImageView *)subview;
                }
                else if ([[[subview class] description] isEqualToString:@"PLCropOverlay"]) {
                    for (UIView *subsubview in subview.subviews) {
                        if ([[[subsubview class] description] isEqualToString:@"PLCameraIrisAnimationView"]) {
                            plCameraIrisAnimationView = [subsubview retain];
                        }
                    }
                }
            }
        }
    }
    cameraIrisImageView.hidden = YES;
    [plCameraIrisAnimationView removeFromSuperview];
    [[NSNotificationCenter defaultCenter] removeObserver:self name:@"UINavigationControllerDidShowViewControllerNotification" object:nil];
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(receivedPLCameraViewIrisAnimationDidEndNotification:) name:@"PLCameraViewIrisAnimationDidEndNotification" object:nil];
}

an升后,除去了里面的形象,并重新添加了感想:

- (void)receivedPLCameraViewIrisAnimationDidEndNotification:(NSNotification *)notification {
    cameraIrisImageView.hidden = NO;

    UIView *view = imagePickerController.view;
    while (view.subviews.count && (view = [view.subviews objectAtIndex:0])) {
        if ([[[view class] description] isEqualToString:@"PLCameraView"]) {
            for (UIView *subview in view.subviews) {
                if ([[[subview class] description] isEqualToString:@"PLCropOverlay"]) {
                    [subview insertSubview:plCameraIrisAnimationView atIndex:1];
                    [plCameraIrisAnimationView release];
                    plCameraIrisAnimationView = nil;
                    break;
                }
            }
        }
    }

    [[NSNotificationCenter defaultCenter] removeObserver:self name:@"PLCameraViewIrisAnimationDidEndNotification" object:nil];
}

以下功能在摄像机的消化开始之前即行。

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

}

在上述职能中,你可以通过使用普通的NSMuatable Array syntax等物体进入每一层。 AtIndex

希望这将有助于你。

关于

Ankur

关于Catalin的回答(大比),我发现,如果你稍微改变“同义词”的方法,该陈述就比较好......但值得注意。

- (void) animateIrisOpen {
    if (iris_) {
        iris_.hidden = NO;
        [iris_ performSelector:kIrisSelector];
    }
}




相关问题
Code sign Error

I have created a new iPhone application.I have two mach machines. I have created the certificate for running application in iPhone in one mac. Can I use the other mac for running the application in ...

ABPersonViewController Usage for displaying contact

Created a View based Project and added a contact to the AddressBook using ABAddressBookRef,ABRecordRef now i wanted to display the added contact ABPersonViewController is the method but how to use in ...

将音频Clips从Peter改为服务器

我不禁要问,那里是否有任何实例表明从Peit向服务器发送音响。 I m不关心电话或SIP风格的解决办法,只是一个简单的袖珍流程......

• 如何将搜查线重新定位?

我正试图把图像放在搜索条左边。 但是,问题始于这里,搜索条线不能重新布署。

热门标签