0

I refer the squareCam example of apple's development library it works fine.

But

When i try to change overlay image on one button click like this

square = [UIImage imageNamed:@"add"];
[self teardownAVCapture];
[self setupAVCapture];

on button click i use this code to change the image and show as overlay.

but i don't know what the problem is but i have to click twice to show the cameraview as first time it just shows black screen.

Help me please. Thanks in advance.

The iOSDev
  • 5,237
  • 7
  • 41
  • 78
  • 2
    where do you use `square`? Your provided code isn't explaining anything. – skram Jun 09 '12 at 10:32
  • it is example from apple development site see [this](http://developer.apple.com/library/ios/samplecode/SquareCam/Introduction/Intro.html#//apple_ref/doc/uid/DTS40011190) example as reference – The iOSDev Jun 09 '12 at 10:37

1 Answers1

0

I got the error. Have to make some changes in the method below shown as I am uses ARC in iOS5.

- (void)teardownAVCapture
{
    [session stopRunning];
    session = nil;
    videoDataOutput = nil;
    dispatch_release(videoDataOutputQueue);
    [stillImageOutput removeObserver:self forKeyPath:@"capturingStillImage"];
    stillImageOutput = nil;
    previewLayer = nil;
    [previewLayer removeFromSuperlayer];
}
The iOSDev
  • 5,237
  • 7
  • 41
  • 78