Hey,
I'm making an eBook app that presents a table view for a user to pick a book, and then based on that selection, loads 35 20kb jpg files into a UIScrollView. I seem to be having memory issues (from what I can tell) when the user selects a book. Sometimes it does load a book (although very slowly) and sometimes the app crashes and throws a strange error:
Here's what the code that lays out my book looks like:
Does anything look wrong here? Thanks!
I'm making an eBook app that presents a table view for a user to pick a book, and then based on that selection, loads 35 20kb jpg files into a UIScrollView. I seem to be having memory issues (from what I can tell) when the user selects a book. Sometimes it does load a book (although very slowly) and sometimes the app crashes and throws a strange error:
Code:
Program received signal: 0.
warning: check_safe_call: could not restore current frame
Here's what the code that lays out my book looks like:
Code:
- (void)layoutBook {
CGRect workingFrame;
workingFrame.origin.x = 0;
workingFrame.origin.y = 0;
workingFrame.size.height = 480;
workingFrame.size.width = 320;
int x;
for(x=1; x<=35; x++) {
UIImage *image = [UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:[NSString stringWithFormat:@"%@%d",currentBook,x] ofType:@"jpg"]];
imageView = [[[UIImageView alloc] initWithFrame:workingFrame] autorelease];
imageView.image = image;
[scrollView addSubview:imageView];
workingFrame.origin.x = workingFrame.origin.x + 320;
}
workingFrame.size.width = workingFrame.origin.x;
[scrollView setContentSize:workingFrame.size];
workingFrame.origin.x = 0;
workingFrame.origin.y = 0;
workingFrame.size.width = 320;
workingFrame.size.height = 480;
[scrollView setFrame:workingFrame];
}
Does anything look wrong here? Thanks!