I open the camera on button click and take the image in uiimage and then transfer that uiimage to other view But i receive memory warning when i do this 4-5 time.
Below is the code i worked for:-
-(void)imagePickerController:(UIImagePickerController*)picker_camera didFinishPickingMediaWithInfo:(NSDictionary*)info
{
[picker_camera dismissModalViewControllerAnimated:YES];
UIImage *image=[[UIImage alloc] init];
image=[info objectForKey:@"UIImagePickerControllerOriginalImage"];
[self Methodcall:image];
//Image_camera=image;
// NSAutoreleasePool *apool = [[NSAutoreleasePool alloc] init];
//printf("first\n");
// [self performSelector:@selector(Methodcall) withObject:nil afterDelay:1];
//printf("ok\n");
//[apool release];
}
-(void)Methodcall:(UIImage *)image{
ImageDisplayViewController *ImageDisplayViewController_obj=[[ImageDisplayViewController alloc] initWithNibName:@"ImageDisplayViewController" bundle:nil];
ImageDisplayViewController_obj.image_FRomCamera=image;
NSLog(@"image===>%@ camera==>%@",image,ImageDisplayViewController_obj.image_FRomCamera);
[self.navigationController pushViewController:ImageDisplayViewController_obj animated:YES];
// [ImageDisplayViewController_obj release];
}
-(IBAction)TakePhotoCamera:(id)sender{
@try
{
UIImagePickerController *picker_camera = [[UIImagePickerController alloc] init];
picker_camera.sourceType = UIImagePickerControllerSourceTypeCamera;
picker_camera.delegate = self;
[self presentModalViewController:picker_camera animated:YES];
[picker_camera release];
}
@catch (NSException *exception)
{
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"No Camera" message:@"Camera is not available " delegate:self cancelButtonTitle:@"Ok" otherButtonTitles:nil];
[alert show];
[alert release];
}
}
Does any one help me out please.
Thanks in advance.