How many changes to content settings in UIScrollview to scale?

In UIScrollview, when I scroll / drag, I got changes to scrollview contentOffset that represent how much I scroll / drag to scrollview. So I updated the subview scroll to scroll.

But, when I zoom in on the scroll (using zoom), the scroll's contentOffsets also change. I don’t understand how much contentOffset has changed, because I cannot bind the changes using the zoomScale value. So, is there anyway to know the changes in contentOffset to scale?

My intention is to get the value of the contentOffset changes for drag and drop during scaling (which is not possible due to a change in the content offset) so that I can update the scrollview routine accordingly.

I'm stuck here. Any help would be greatly appreciated.

thank

Shaikot

+3
source share
1 answer

I created a small test project, and it looks like contentOffset is being multiplied by zoomScale. Therefore, if you want to explain this, simply divide it by zoomScalebefore using it.

, : scrollView , , . , , . contentOffset scrollView, :

CGPoint contentOffset = self.scrollView.contentOffset;
CGFloat zoomScale = self.scrollView.zoomScale;

self.moveView.frame = CGRectMake((contentOffset.x+10)/zoomScale,
                                 (contentOffset.y+10)/zoomScale,
                                 10,
                                 10);

moveView , , .

, , , , .

+5

Source: https://habr.com/ru/post/1750238/


All Articles