UIScrollView: Is 806k Image too much too handle? (Crash, out of memory)?
Posted
by Jordan
on Stack Overflow
See other posts from Stack Overflow
or by Jordan
Published on 2010-05-06T02:59:27Z
Indexed on
2010/05/06
3:08 UTC
Read the original article
Hit count: 290
I'm loading a 2400x1845 png image into a scroll view. The program crashes out of memory, is there a better way to handle this? mapScrollView is an UIScrollView in IB, along with a couple of UIButtons.
-(void)loadMapWithName:(NSString *)mapName
{
NSString* bundlePath = [[NSBundle mainBundle] bundlePath];
UIImage *image = [UIImage imageWithContentsOfFile:[NSString stringWithFormat:@"%@/path/%@", bundlePath, [maps objectForKey:mapName]]];
UIImageView *imageView = [[UIImageView alloc] initWithImage:image];
CGSize imgSize = image.size;
mapScrollView.contentSize = imgSize;
[mapScrollView addSubview:imageView];
[imageView release];
[self.view addSubview:mapScrollView];
}
© Stack Overflow or respective owner