Hi,
In my app, I have two view controllers. The MainViewController switches to the AlbumViewController when a button is pressed. The AlbumVC is supposed to allow the user to select a picture from the PhotoLibrary and/or CameraRoll. So, I try to fire up the UIImagePickerController.
However, when the app runs, I don't see the UIImagePickerController at all. Not compiler errors and no run time errors.
Can some kind soul help me!
Here is the source..... Sam
MainViewController.h
#import <UIKit/UIKit.h>
@interface iNotateViewController : UIViewController {
}
@end
MainViewController.m
#import "iNotateViewController.h"
@implementation iNotateViewController
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning]; // Releases the view if it doesn't have a superview
// Release anything that's not essential, such as cached data
}
- (void)dealloc {
[super dealloc];
}
@end
AlbumViewController.h
#import <UIKit/UIKit.h>
#import <UIKit/UIViewController.h>
@interface AlbumViewController : UIViewController <UINavigationControllerDelegate,
UIImagePickerControllerDelegate >{
}
@end
AlbumViewController.m
- (void)viewDidLoad {
[super viewDidLoad];
if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypePhotoLibrary]) {
UIImagePickerController *picker;
picker = [[UIImagePickerController alloc] init];
picker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
picker.allowsImageEditing = YES;
picker.delegate = self;
[self presentModalViewController:picker animated:YES];
[picker release];
}
}
-(void)imagePickerController: (UIImagePickerController *) picker
didFinishPickingImage: (UIImage *) image
editingInfo: (NSDictionary *) editingInfo {
[self useImage:image];
[[picker parentViewController] dismissModalViewControllerAnimated:YES];
}
-(void)imagePickerControllerDidCancel: (UIImagePickerController *)picker {
[[picker parentViewController] dismissModalViewControllerAnimated:YES];
}
@end