EGOPhotoViewer:从特定照片开始

时间:2011-06-23 23:44:50

标签: iphone ios uiimage

我正在使用EGOPhotoViewer从网络上加载一堆图像。它们首先以缩略图显示,因此当用户点击其中一个拇指时,我想先在EGOPhotoViewer中显示该图像。因此,如果我点击第5张图像,它会从20或5开始加载图像查看器。

有办法做到这一点吗?

ZSPhoto *photo;

for (Asset *a in items) {
    photo = [[ZSPhoto alloc] initWithImageURL:[NSURL URLWithString:a.imgURL] name:a.caption];
    [photos addObject:photo];
    [photo release];
}

// Photosource
ZSPhotoSource *photoSource = [[ZSPhotoSource alloc] initWithPhotos:[NSArray arrayWithArray:photos]];
EGOPhotoViewController *photoController = [[EGOPhotoViewController alloc] initWithPhotoSource:photoSource];

// Set starting photo index here?

UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:photoController];
navController.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
navController.modalPresentationStyle = UIModalPresentationFullScreen;
[self presentModalViewController:navController animated:YES];
[navController release];
[photoController release];

3 个答案:

答案 0 :(得分:3)

我遇到了同样的问题,我正在做的是尝试moveToPhotoAtIndex:然后将它推送到navigationController。你需要在以后完成。

这是我如何让它为我的应用程序工作......

//从tableView

获取indexPath
-(void)showSelectedPhoto:(NSIndexPath *)indexPath{

    // Already had photoControllerView declared in header, init with your photo source
    photoControllerView = [[EGOPhotoViewController alloc] initWithPhotoSource:source];

    // pushed the photoControllerView to the navigation controller
    [self.navigationController pushViewController:photoController animated:YES];

    // THEN you moveToPhotoAtIndex and it should work correctly!
    [photoController moveToPhotoAtIndex:indexPath.row animated:NO];
}

希望这有助于澄清事情!

答案 1 :(得分:2)

您应该可以使用方法moveToPhotoAtIndex:animated:

答案 2 :(得分:0)

我正在使用相同的过程在图像查看器中加载图像。和app工作正常。你可以从这里得到代码

selected image wouldnt load in ego image viewer in ios 7

希望你能得到帮助。