我使用下面的代码来显示自定义相机控件。当我在 viewDidLoad 中评论 cameraSetup 方法时,应用程序未收到任何内存警告。知道它为什么会收到内存警告吗?
- (void)viewDidLoad {
[super viewDidLoad];
[self cameraSetup];
}
- (void)cameraSetup {
#if TARGET_IPHONE_SIMULATOR
[self showImagePickerForSourceTypeInTakePhoto:UIImagePickerControllerSourceTypePhotoLibrary];
#else
[self showImagePickerForSourceTypeInTakePhoto:UIImagePickerControllerSourceTypeCamera];
#endif
}
- (void)showImagePickerForSourceTypeInTakePhoto:(UIImagePickerControllerSourceType)sourceType {
self.imagePickerController = [[UIImagePickerController alloc] init];
self.imagePickerController.modalPresentationStyle = UIModalPresentationCurrentContext;
self.imagePickerController.sourceType = sourceType;
self.imagePickerController.delegate = self;
if (sourceType == UIImagePickerControllerSourceTypeCamera){
self.imagePickerController.showsCameraControls = NO;
self.overlayView.frame = self.view.frame ;//imagePickerController.cameraOverlayView.frame;
self.imagePickerController.cameraOverlayView = self.overlayView;
}
[self presentViewController:self.imagePickerController animated:NO completion:nil];
}