从JTSImageViewController中解除时重置View

时间:2015-05-07 10:49:40

标签: ios objective-c uitableview

我有UITableView图片。当我向下滚动并选择一个图像时,我正在使用以下库进行图像的Onclick,使其zoomIn / ZoomOut / Panning等。当我回来时,tableview再次从0元素开始向后滚动。我没有使用didSelectRow,而是使用自定义选择器。以前有人和这个图书馆合作过吗?如果需要,我可以发布代码。

https://github.com/jaredsinclair/JTSImageViewController

分配选择器

    AsyncImageView *imageView = [[AsyncImageView alloc] initWithFrame:CGRectMake(10.0f, 0.0f, 300.0f, 300.0f)];
    imageView.contentMode = UIViewContentModeScaleAspectFit;

    [imageView setUserInteractionEnabled:YES];
    UITapGestureRecognizer *tapRecognizer = [[UITapGestureRecognizer alloc] init];
    [tapRecognizer addTarget:self action:@selector(bigButtonTapped:)];
    [imageView addGestureRecognizer:tapRecognizer];

方法调用

- (void)bigButtonTapped:(id)sender {

UIView *view = [sender view];
AsyncImageView *imageView1 = (AsyncImageView *)[view viewWithTag:IMAGE_VIEW_TAG];

// Create image info
JTSImageInfo *imageInfo = [[JTSImageInfo alloc] init];
#if TRY_AN_ANIMATED_GIF == 1

#else
imageInfo.image = imageView1.image;
#endif
imageInfo.referenceRect = imageView1.frame;
imageInfo.referenceView = imageView1.superview;
imageInfo.referenceContentMode = imageView1.contentMode;
imageInfo.referenceCornerRadius = imageView1.layer.cornerRadius;

// Setup view controller
JTSImageViewController *imageViewer = [[JTSImageViewController alloc]
                                       initWithImageInfo:imageInfo
                                       mode:JTSImageViewControllerMode_Image
                                       backgroundStyle:JTSImageViewControllerBackgroundOption_Blurred];

// Present the view controller.
[imageViewer showFromViewController:self transition:JTSImageViewControllerTransition_FromOriginalPosition];
}

1 个答案:

答案 0 :(得分:2)

似乎JSTImageViewControllerUITableView中的iOS8不一致。 GitHub的{​​{1}}页面已报告此问题。还有一个可能的解决方法:

  

...显然这是从模态视图控制器返回后重置contentOffset的默认行为...
  ...将JTSImageViewController的模态表示样式设置为UIModalPresentationOverFullScreen可以解决问题(因为它不会删除它下面的层次结构并保留我认为的滚动位置)。

JSTImageViewController

阅读完整帖子Here