//
//  ImageViewerViewController.m
//  ImageViewer
//
//  Created by Lieven Dekeyser on 10/12/09.
//  Copyright Lieven Dekeyser 2009. All rights reserved.
//

#import "ImageViewerViewController.h"

@implementation ImageViewerViewController

- (IBAction)pickImage
{
	NSLog(@"test");
	
	UIImagePickerController * imagePicker = [[[UIImagePickerController alloc] init] autorelease];
	imagePicker.delegate = self;
	
	[self presentModalViewController:imagePicker animated:YES];
}

- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
{
	UIImage * theImage = [info objectForKey:UIImagePickerControllerOriginalImage];
	
	imageView.image = theImage;
	
	[self dismissModalViewControllerAnimated:YES];
}

- (void)imagePickerControllerDidCancel:(UIImagePickerController *)picker
{
	NSLog(@"Image picker canceled");
	[self dismissModalViewControllerAnimated:YES];
}

- (BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation
{
	return YES;
}


@end
