问题
I am using EGOPhotoViewer to load up a bunch of images from the s3. They are shown in thumbnails first in table view, so when a user clicks 5th row of image, it loaded the image into image viewer starting at 5 of 20 . and this is working smoothly in ios 6.
but when I installed ios 7 and run my app.I got an error. it fails to load the clicked image. when user click 5th row of image,image viewer load the very 1st image starting at 1 of 20.
i am using this much of code.
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{ ......
[self showSelectedPhoto:indexPath];
......
}
//load the selected image
-(void)showSelectedPhoto:(NSIndexPath *)indexPath
{
[UserInfo sharedInfo].Path=indexPath;
NSLog(@"%@",indexPath);
NSString *passingImageName=[[self.tableDataSource objectAtIndex:indexPath.row]objectForKey:@"fileName"];
NSMutableArray *photoArray=[self getFilteredArray];
NSMutableArray *urlsArray=[[NSMutableArray alloc] init];
// [self.tableView reloadData];
for (NSString *string in photoArray) {
NSLog(@"String Values:%@",string);
NSURL *imageUrl=[self getEnlargedImageImageUrl:[self._prefix stringByAppendingString:string]];
NSLog(@"Passing url is:%@",imageUrl);
photo = [[EGOQuickPhoto alloc] initWithImageURL:imageUrl name:string];
[urlsArray addObject:photo];
}
self.source=[[EGOQuickPhotoSource alloc]initWithPhotos:urlsArray];
photoController = [[EGOPhotoViewController alloc] initWithPhotoSource:source];
[self.navigationController pushViewController:photoController animated:YES];
NSUInteger index = [photoArray indexOfObject:passingImageName];
NSLog(@"index = %lu",(unsigned long)index);
[photoController moveToPhotoAtIndex:index animated:NO];
}
so it is ios 7 ui bug or whatever?
回答1:
I got the solution of this,And it working fine For my app in IOS 7.
In EGOphotoviewer
- (void)scrollViewDidScroll:(UIScrollView *)scrollView {
NSInteger _index = [self centerPhotoIndex];
if (_index >= [self.photoSource numberOfPhotos] || _index < 0) {
return;
}
//Change here for IOS7...add "&&_index>0" after _rotating
if (_pageIndex != _index && !_rotating && _index > 0) {
[self setBarsHidden:NO animated:YES];
_pageIndex = _index;
[self setViewState];
if (![scrollView isTracking]) {
[self layoutScrollViewSubviews];
}
}
}
回答2:
In EGOphotoviewcontroller in viewwillappear method
if ([self.navigationController isToolbarHidden] && (!_popover || ([self.photoSource numberOfPhotos] > 1))) {
[self.navigationController setToolbarHidden:NO animated:YES];
}
After calling this method in ios7 _pageindex value getting zero,i don't know the actual reason for this, but i will give one idea. just assign _pageindex value after this statement,like indexpath.row or may be tag value what youwant to assign,
Then the things are going good... njoy...
来源:https://stackoverflow.com/questions/19270749/selected-image-wouldnt-load-in-ego-image-viewer-in-ios-7