缩放 UIScrollView 内容时出现问题
我正在开发一个应用程序,其中我将一组图像放置在滚动视图上。我可以放置图像并根据需要指定内容大小以适合所有图像数量。每个图像视图的大小为 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您需要创建子滚动视图的滚动视图来保存图像视图。然后在每个子滚动视图上配置缩放。
You need to create a scrollView of sub-scrollviews to hold the imageViews. Then configure zoom on each sub-scrollviews.