Hey guys,
I have problems with my uiImagePickerController. I can take one shot with that code:
imagePickerController = [[UIImagePickerController alloc] init];
imagePickerController.delegate = self;
imagePickerController.sourceType = UIImagePickerControllerSourceTypeCamera;
imagePickerController.wantsFullScreenLayout = NO;
imagePickerController.allowsEditing = NO;
imagePickerController.showsCameraControls = NO;
imagePickerController.cameraViewTransform = CGAffineTransformScale(imagePickerController.cameraViewTransform, 0.5, 0.5); // to scale my live preview
//[self presentModalViewController:imagePickerController animated:YES]; // this is not working with "self"
[[[CCDirector sharedDirector] openGLView] addSubview:imagePickerController.view];
and then I add the current photo with this method:
- (void)imagePickerController:(UIImagePickerController *)imagePickerController didFinishPickingMediaWithInfo:(NSDictionary *)info
{
NSLog(@"imagePickerController didFinishPickingMediaWithInfo");
// remove imagePickerController
[imagePickerController dismissModalViewControllerAnimated:YES];
[imagePickerController.view removeFromSuperview];
[imagePickerController release];
// remove old shot
[self removeChild:shot cleanup:YES];
shot = nil;
// add new buttons
[self addViewWithButtonsWrapper:2];
// resize image
UIImage* image = [info objectForKey:@"UIImagePickerControllerOriginalImage"];
image = [self imageWithImage:image scaledToSize:CGSizeMake(320, 480)];
// add current shot
shot = [CCSprite spriteWithCGImage:image.CGImage key:@"UIImagePickerControllerOriginalImage"];
shot.position = ccp(ADJUST_X((HD_PIXELS(160) - (image.size.width / 2))), ADJUST_Y(0));
[self addChild:shot];
}
I have a button named "Take picture" which takes the picture and starts the second code part. "Take picture" will change to "New Picture" and you should be able to dp another shot till you are satisfied.
But now there is my problem: The photo (content of "shot") is always the one from the first shot.
Any ideas, you would help me so much. Thanks.