В моем приложении у меня есть два контроллера представления. MainViewController переключается на AlbumViewController при нажатии кнопки. Предполагается, что AlbumVC позволяет пользователю выбрать изображение из PhotoLibrary и / или CameraRoll. Итак, я пытаюсь запустить UIImagePickerController.
Однако, когда приложение запускается, я вообще не вижу UIImagePickerController. Не ошибки компилятора и ошибки времени выполнения.
Может ли какая-то добрая душа помочь мне!
Вот источник ..... Сэм
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