开发者

issue while zooming content of UIScrollView

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 UI开发者_JAVA技巧ImageView 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


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜