views:

72

answers:

2

Hi, I've declared PLCameraContoller instance in my AppDelegate class as:-

self.cameraController = [PLCameraController performSelector:@selector(sharedInstance)];
[cameraController setDelegate:self];

And I'm accessing it in one of my viewcontroller class as:-

del = [[UIApplication sharedApplication] delegate];
UIView *previewView = [del.cameraController performSelector:@selector(previewView)];
previewView.frame = CGRectMake(0,0, 320, 480);
self.view = previewView;
[del.cameraController performSelector:@selector(startPreview)];
[del.cameraController performSelector:@selector(setCameraMode:) withObject:(NSNumber*)1];

Where "del" is an instance of my AppDelegate class.

But i can see only black background in my viewcontroller view in iphone device.

Also if i remove "self" from the appdelegate.m code of cameracontroller it also showing blank.

How can i get camera in my view controller? I'm pretty much struggling with it.

Thanks in Adv.

A: 

This sample might help you:link text

petert
A: 

You might have forgotten to retain the PLCameraController instance. Did you declare the cameraController with the retain attribute? If not, you'll need to retain it manually.

[cameraController retain];
Arrix