Hey guys, i was about to upload an app yesterday when just before i noticed a little bug.
Basically i have a view that when tapped brings up a small scroll view at the bottom, that new scroll view holds thumbnail images. The user can tap an image from that view and it will appear on the main view. However the problem with this is that the image that appears on the main view is just the thumbnail and not the full image.
I think the problem comes from this section of code:
Code:
- (void)pickImageNamed:(NSString *)name {
// first remove previous image view, if any
[[imageScrollView viewWithTag:ZOOM_VIEW_TAG] removeFromSuperview];
NSString *pathComponent = [NSString stringWithFormat:@"Documents/%@", name];
NSString *imageDirectionString = [NSHomeDirectory() stringByAppendingPathComponent:pathComponent];
UIImage *image = [UIImage imageWithContentsOfFile:imageDirectionString];
TapDetectingImageView *zoomView = [[TapDetectingImageView alloc] initWithImage:image];
[zoomView setDelegate:self];
[zoomView setTag:ZOOM_VIEW_TAG];
[imageScrollView addSubview:zoomView];
[imageScrollView setContentSize:[zoomView frame].size];
// choose minimum scale so image width fits screen
float minScale = [imageScrollView frame].size.width / [zoomView frame].size.width;
[imageScrollView setMinimumZoomScale:minScale];
[imageScrollView setZoomScale:minScale];
[imageScrollView setContentOffset:CGPointZero];
}
The bold line should be bringing up the issue as it is looking for a name, and that is set when the user taps the thumbnail. So instead of picking the image named: image01.png it picks the image01-thumb.png
Code:
- (void)thumbImageViewWasTapped:(ThumbImageView *)tiv {
[self pickImageNamed:[tiv imageName]];
[self toggleThumbView];
}
Any ideas how i should alter the code in order to stop loading the incorrect image?
Thanks for any help
Joe