我右上角有一个UICollectionView和一个条形按钮(CameraViewController1:UICollectionViewController)。当我拍照时它会移动到一个新的视图控制器,在那里可以裁剪图像。用户有两个选项Use and Cancel after选择任何一个选项它会将图像返回到集合视图,它会像单元格一样排列。我想要拍很多照片。但是我只能在应用程序崩溃的情况下最多拍摄3张图片并显示消息&#34 ;应用程序由于内存压力而终止"但最糟糕的是,当我在运行iOS 7的iPhone 5中测试相同的应用程序时,崩溃并未发生。当我在运行iOS 7的iPhone 4中测试相同时,它得到了坠毁并产生收到的记忆警告。
这是我的代码
- (IBAction)TakeaPhoto:(id)sender {
[[UIApplication sharedApplication]setStatusBarHidden:FALSE withAnimation:NO];
gallery=0;
picker1 = [[UIImagePickerController alloc] init];
picker1.delegate = self;
self.resizeableCropArea =YES;
self.cropSize=CGSizeMake(300,350);
//picker1.allowsEditing = YES;
picker1.sourceType = UIImagePickerControllerSourceTypeCamera;
[self presentViewController:picker1 animated:YES completion:NULL];
}
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {
[self dismissViewControllerAnimated:YES completion:NULL];
UIImage *image = [info objectForKey: UIImagePickerControllerOriginalImage];
image_cap = [self imageTemp:image scaledToSize:CGSizeMake(320, 370)];
dataTemp = UIImageJPEGRepresentation(image,0.0);
CropViewController *cropController = [[CropViewController alloc] init];
cropController.sourceImage = [info objectForKey:UIImagePickerControllerOriginalImage];
Original_img = UIImageJPEGRepresentation(cropController.sourceImage,0.0);
[original_image addObject:[UIImage imageWithData:Original_img]]; //original_image Nsmutablearray
NSLog(@"source image=%@",cropController.sourceImage);
cropController.resizeableCropArea = self.resizeableCropArea;
cropController.cropSize = self.cropSize;
cropController.delegate = self;
Cancel_Image= cropController.sourceImage;
[self.navigationController pushViewController:cropController animated:YES];
}
答案 0 :(得分:0)
希望这对你有用,你的应用程序将顺利运行......:)