English 中文(简体)
摄像机在Shtter im
原标题:cameraOverlayView above Shutter animation

I have a transparent view with a rectangle drawn onto it using CoreGraphics. When the camera launches the custom overlay view is above the shutter animation. What you see is the standard camera shutter with the custom rectangle above it. How do I get it to go in the right place, underneath the shutter animation? I ve looked at other sample code but it s for OS 3.1 and doesn t seem to do anything differently.

Here s my code:

-(IBAction)cameraButton{
if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerCameraDeviceRear]){

    UIImagePickerController *picker = [[UIImagePickerController alloc] init];
    picker.delegate = self;
    picker.sourceType =  UIImagePickerControllerSourceTypeCamera;

    //Add the OverlayView with the custom Rectangle
    CGRect overlayFrame = CGRectMake(0.0f, 0.0f, 320.0f, 480.0f);
    OverlayView *overlayView = [[OverlayView alloc]initWithFrame:overlayFrame];
    picker.cameraOverlayView = overlayView;
    [overlayView release];

    [self presentModalViewController:picker animated:YES];
    [picker release];
}
}
问题回答

On the iPad this problem doesn t exist, and the overlay view is behind the shutter animation by default. But on the iPhone, the overlay appears at front.

我为我找到了解决办法。

您必须把超时观点作为这一方法的分点:

- (void)navigationController:(UINavigationController *)navigationController willShowViewController:(UIViewController *)viewController animated:(BOOL)animated {
    if (!viewController)
        return;

    UIView* controllerViewHolder = viewController.view;
    UIView* controllerCameraView = [[controllerViewHolder subviews] objectAtIndex:0];
    UIView* controllerPreview = [[controllerCameraView subviews] objectAtIndex:0];
    [controllerCameraView insertSubview:self.overlayView aboveSubview:controllerPreview];
}

希望会有助于

Original source: http://www.alexcurylo.com/blog/2009/06/18/uiimagepickercontroller-in-3-0/

你可能不会做你已经做的事情以外的任何事情;如果安理会决定对关闭者采取过长的观点,那么你就不得不与它共处(除非你想冒着从仓库中被拒的风险)。

作为一种不完美的工作,你可以开始用字母=0超支,然后在第二或二年后将甲型六氯环己烷设定为1。 但是,在开放之前没有固定的关闭时间(我认为这取决于发射照相硬件需要多长时间),因此,有时你的接口可能不会到晚才出现,有时可能太早。

从4.3.3起,由于部件在顶上显示,然后在im开始时 s下。 I ve将此称为雷达:

我回答了一个类似的问题:here。 为我工作的人(SOS 6)正在航海中安装照相机OverlayView:willShowViewController:animated。

- (void) navigationController:(UINavigationController*) navigationController willShowViewController:(UIViewController*) viewController animated:(BOOL) animated {
    self.imagePickerController.cameraOverlayView = ...; // your camera overlay view
}




相关问题
List Contents of Directory in a UITableView

I am trying to list the contents of Ringtones directory in a TableView, however, I am only getting the last file in the directory in ALL cells, instead of file per cell. This is my code: - (...

iPhone NSUserDefaults persistance difficulty

In my app i have a bunch of data i store in the NSUserdefaults. This information consists of an NSObject (Object1) with NSStrings and NSNumbers and also 2 instances of yet another object (Object2). ...

Writing a masked image to disk as a PNG file

Basically I m downloading images off of a webserver and then caching them to the disk, but before I do so I want to mask them. I m using the masking code everyone seems to point at which can be found ...

Resize UIImage with aspect ratio?

I m using this code to resize an image on the iPhone: CGRect screenRect = CGRectMake(0, 0, 320.0, 480.0); UIGraphicsBeginImageContext(screenRect.size); [value drawInRect:screenRect blendMode:...

Allowing interaction with a UIView under another UIView

Is there a simple way of allowing interaction with a button in a UIView that lies under another UIView - where there are no actual objects from the top UIView on top of the button? For instance, ...

热门标签