user281300
user281300

Reputation: 1457

Zooming into specific grids on a UISCROLLVIEW

i.e size 330 by 230 each which lays out nicely in a 3 by 3 grid(3 columns , 3 rows). When we tap on it needs to zoom in and I need to be able to scroll around with paging enabled. (This only works if the frame of the scrollview is the size of the screen). i.e frame = cgrectmake(0,0,1024,768);

I actually got the zooming to work accordingly for the grids in the end but the main issue i had was the scrolling. Because the scrollview size triples, the actual origins change so if I try to set the frame to the screen size, then the zoom moves back to 0,0 which looks odd(very hard to explain). Anyways to cut it short, this is what I am trying to do:

zoom into the specific grid according to location of the tap then scroll around when zoomed in but using paging enabled.

Any suggestions appreciated. I also tried using anchor points etc..

The code for the transformation is as follows:

I did not change any anchor points, so that zooms in the centre and increases the size by 3. I believe that now the top left corner of the scrollview is not 0,0 anymore.

 CGAffineTransform t = self.backgroundView.transform;
    t = CGAffineTransformMakeScale(3, 3);
    self.backgroundView.transform = t;//scrollview.
    self.backgroundView.contentSize = CGSizeMake(vw,vh);

Upvotes: 0

Views: 153

Answers (1)

Simon Lee
Simon Lee

Reputation: 22334

Can you post some code for how you are doing the zooming? The content positions should not change when zoomed, the zoomFactor simply tells the scroll view to show the enlarged content.

Upvotes: 1

Related Questions