Reputation: 1910
I am getting a memory warning and the app crashes.
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
{
UIImage *image = [info objectForKey:UIImagePickerControllerOriginalImage];
[self.btnSelectImage setImage:image forState:UIControlStateNormal];
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad)
{
[popOverSelectImage2 dismissPopoverAnimated:YES];
UIViewController *vc = [[UIViewController alloc]init];
vc.view = self.captionView;
[popOverSelectImage setPopoverContentSize:CGSizeMake(self.captionView.frame.size.width, self.captionView.frame.size.height) animated:NO];
popOverSelectImage.contentViewController = vc;
[vc release];
}
else
{
[self dismissModalViewControllerAnimated:YES];
}
self.imageToSave = image;
self.imagePicker = nil;
}
Upvotes: 0
Views: 87
Reputation: 150615
When you set an image on a button, although it is displayed at a smaller size, it is using the full image, which, if you are getting it from the camera library, is going to be reasonably big.
If you are using a lot of these images, then you are going to be using a lot of memory.
If you want to use lots of these images as button images, then you should create smaller images at the size you require and use these thumbnails instead of the full image. You'll use a lot less memory this way.
Upvotes: 3