i have some sample code of adding a UIImagePickerController to the subview of a window within the AppDelegate (which works fine), but i want to perform this action for a view within my view controller. All the code I see online is the same as mine, but theirs doesn't explicitely call [view addSubview:imagePicker.view]. anyway, when i run the following it compiles and runs fine, but all i see is a white screen with a blue bar at the top, so i'm clearly doing something wrong.
ViewController.h:
ViewController.m:
any ideas?
ViewController.h:
Code:
@interface ViewController : UIViewController <UINavigationControllerDelegate, UIImagePickerControllerDelegate>{
UIView* uiView;
UIImageView *imageView;
UIImagePickerController *imagePicker;
}
ViewController.m:
Code:
- (void)viewDidLoad {
[super viewDidLoad];
self.view = [[UIView alloc] initWithFrame:[[UIScreen mainScreen] applicationFrame]];
imagePicker = [[UIImagePickerController alloc] init];
imagePicker.allowsImageEditing = YES;
imagePicker.delegate = self;
imagePicker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
[self.view addSubview:imagePicker.view];
}
any ideas?