缩放 UIScrollView 内容时出现问题

发布于 2024-11-24 06:08:41 字数 1166 浏览 1 评论 0原文

我正在开发一个应用程序,其中我将一组图像放置在滚动视图上。我可以放置图像并根据需要指定内容大小以适合所有图像数量。每个图像视图的大小为 768,1024。我设置属性滚动视图上的 pagingEnabled 为 YES,以便在用户滑动时移动到下一个图像。我在滚动滚动视图时将每个图像加载到图像视图中。 ie - (void)scrollViewDidScroll:(UIScrollView *)scrollView{

问题: 我面临的问题是,当我缩放 UIImageView 时,imageView 正在缩放,但缩放后的 imageView 被其下一个 imageView 重叠,其大小指定为 768,1024。我包括如下委托方法。

- (UIView *)viewForZoomingInScrollView:(UIScrollView *)scrollView{
return [scrollView viewWithTag:tempTag-1];

- (void)scrollViewWillBeginZooming:(UIScrollView *)scrollView withView:(UIView *)view{
scrollView.pagingEnabled=NO;
[scrollView viewWithTag:tempTag].frame=CGRectMake(scrollView.contentSize.width-768, [scrollView viewWithTag:tempTag].frame.origin.y, [scrollView viewWithTag:tempTag].frame.size.width, [scrollView viewWithTag:tempTag].frame.size.height);
}
- (void)scrollViewDidEndZooming:(UIScrollView *)scrollView withView:(UIView *)view atScale:(float)scale{
if (scrollView.zoomScale<=1) {
    scrollView.pagingEnabled=YES;
}
}

尝试根据内容大小将下一个 imageView 的框架更改为当前 ImageView,但它不起作用。

有人可以在这方面帮助我吗..

提前 TNX

i am developing an application in which i am placing a set of images on a scrollView.i could place the images and given the contentSize as required to fit all the number of images.each imageView is of size 768,1024.i set the property of pagingEnabled to YES on the scrollview,to move to next image as the user swipes. i am loading each image into the imageview on scrolling the scrollView. i.e - (void)scrollViewDidScroll:(UIScrollView *)scrollView{

issue:
the issue i face is when i zoom a UIImageView the imageView is getting zoomed but the zoomed imageView is being overlapped by its next imageView with its size assigned i.e 768,1024. i included the delegate methods as below.

- (UIView *)viewForZoomingInScrollView:(UIScrollView *)scrollView{
return [scrollView viewWithTag:tempTag-1];

}

- (void)scrollViewWillBeginZooming:(UIScrollView *)scrollView withView:(UIView *)view{
scrollView.pagingEnabled=NO;
[scrollView viewWithTag:tempTag].frame=CGRectMake(scrollView.contentSize.width-768, [scrollView viewWithTag:tempTag].frame.origin.y, [scrollView viewWithTag:tempTag].frame.size.width, [scrollView viewWithTag:tempTag].frame.size.height);
}
- (void)scrollViewDidEndZooming:(UIScrollView *)scrollView withView:(UIView *)view atScale:(float)scale{
if (scrollView.zoomScale<=1) {
    scrollView.pagingEnabled=YES;
}
}

i tried to change the frame of the next imageView to current ImageView depending on the content size but it didn't work.

can some one help me in this regard..

TNX in advance

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

故笙诉离歌 2024-12-01 06:08:41

您需要创建子滚动视图的滚动视图来保存图像视图。然后在每个子滚动视图上配置缩放。

You need to create a scrollView of sub-scrollviews to hold the imageViews. Then configure zoom on each sub-scrollviews.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文