-(void) openPhotoLib:(id)sender {
[self dismissModalViewControllerAnimated:YES];
UIImagePickerController *imagePicker = [[UIImagePickerController alloc] init];
[imagePicker setSourceType:UIImagePickerControllerSourceTypePhotoLibrary];
[imagePicker setDelegate:self];
[self presentModalViewController:imagePicker animated:YES];
NSLog(@"openPhotoLib called");
}
Nothing happens except for the NSLog, even though my view controller is a subclass of UINavigationController and UIImagePickerDelegate. Does anyone have any insight or experience with UIImagePickerController?
I should note that I'm primarily using an iPhone for testing.
SOLUTION: Make a new class that subclasses ONLY UINavigationBarDelegate and UIImagePickerDelegate. In that classes's viewDidAppear, put the code to modally present the imagePicker. Create an instance of this class inside the method (inside another class, import the .h file and all) and the modally present that class.
^ I take it back. The modal animations was the real problem. Trying to use another class instance for this messes up the method implementations of UIImagePicker.