我写的是用户自带照片的照片,然后通过一系列意见,利用导航控制器调整图像。 如果用户与前线照相照相照相照(在支持该照相的装置上作为违约),但当我重复这一过程时,我会半途经,在发出记忆警告后坠毁。
在对文书进行描述后,我看到,在使用低分辨率前照相机图像时,我的记忆足迹保持在约20-25兆赫,但在使用背照相机时,每次视的变化会增加33兆赫,直至其坠毁约350兆赫(4S)
Below is the code I m using to handle saving the photo to the documents directory, and then reading that file location to set the image to a UIImageView
. The "read" portion of this code is recycled through several view controllers (viewDidLoad) to set the image I saved as the background image in each view as I go.
我已删除了我的所有图像修改法,以缩小这一差距,以尽量减少孤立问题的努力,我似乎无法找到这个问题。 如今,所有的照片都是在第一眼中拍摄的照片,然后将照片用作另外大约10个观点的背景形象,通过观点把这种照片作为用户门槛。
现在,高分辨率的照片显然将使用更多的记忆,但我不理解的是,为什么低分辨率的光照像似乎在像我那样使用更多的记忆,而高分辨率的光照相在坠毁之前越来越多地使用。
我如何拯救和阅读形象:
- (void) imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
{
UIImage *image = [info objectForKey:@"UIImagePickerControllerOriginalImage"];
jpgData = UIImageJPEGRepresentation(image, 1);
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsPath = [paths objectAtIndex:0];
filePath = [documentsPath stringByAppendingPathComponent:@"image.jpeg"];
[jpgData writeToFile:filePath atomically:YES];
[self dismissModalViewControllerAnimated:YES];
[disableNextButton setEnabled:YES];
jpgData = [NSData dataWithContentsOfFile:filePath];
UIImage *image2 = [UIImage imageWithData:jpgData];
[imageView setImage:image2];
}
现在我知道,我可以尝试扩大形象,而我只想这样做,我计划再研究一下,但我看不出为什么这样做没有做。 Maybe 我的印象是,阿革委在离开顶端时自动处理已分配的观点和看法。
谁能说明为什么我储存着我的设备记忆? (精干一米,完全超视) 难道我会想把ARC扔出窗户吗?
<>光线> 我如何在我的其他观点中要求形象
- (void)loadBackground
{
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsPath = [paths objectAtIndex:0];
NSString *filePath = [documentsPath stringByAppendingPathComponent:@"image.jpeg"];
UIImage *image = [UIImage imageWithContentsOfFile:filePath];
[backgroundImageView setImage:image];
}
• 如何在我的看法控制人员之间建立联系:
<><><><>>>>
我的基本声明如下:
#import <UIKit/UIKit.h>
#import <AVFoundation/AVFoundation.h>
@interface PhotoPickerViewController : UIViewController <UIImagePickerControllerDelegate, UINavigationControllerDelegate>
{
IBOutlet UIImageView *imageView;
NSData *jpgData;
NSString *filePath;
UIImagePickerController *imagePicker;
IBOutlet UIBarButtonItem *disableNextButton;
}
@end
If relevant, how I call up my image picker:
- (void)callCameraPicker
{
if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera] == YES)
{
NSLog(@"Camera is available and ready");
imagePicker.sourceType = UIImagePickerControllerSourceTypeCamera;
imagePicker.delegate = self;
imagePicker.allowsEditing = NO;
imagePicker.cameraCaptureMode = UIImagePickerControllerCameraCaptureModePhoto;
NSArray *devices = [AVCaptureDevice devicesWithMediaType:AVMediaTypeVideo]; for (AVCaptureDevice *device in devices)
{
if([[UIScreen mainScreen] respondsToSelector:@selector(scale)] && [[UIScreen mainScreen] scale] == 2.0)
{
imagePicker.cameraDevice = UIImagePickerControllerCameraDeviceFront;
}
}
imagePicker.modalTransitionStyle = UIModalTransitionStyleCoverVertical;
[self presentModalViewController:imagePicker animated:YES];
}
else
{
NSLog(@"Camera is not available");
UIAlertView *cameraAlert = [[UIAlertView alloc] initWithTitle:@"Error"
message:@"Your device doesn t seem to have a camera!"
delegate:self cancelButtonTitle:@"Dismiss"
otherButtonTitles:nil];
[cameraAlert show];
}
}
<><><><>>>>> 挂着眼光,实际上,它现在没有叫上这样一米,在<条码>上载荷Background,在<条码>上登见WillAppear,在<条码>上贴出我的条码>背底字。 我期望这样做会有所助益,但不会有所改观。
- (void)viewWillAppear:(BOOL)animated
{
[self loadBackground];
}
- (void)viewDidDisappear:(BOOL)animated
{
NSLog(@"ViewDidDisappear");
backgroundImageView = nil;
}