iPhone: how do i redraw subviews while pinch zooming a uiscrollview

Posted by Mike on Stack Overflow See other posts from Stack Overflow or by Mike
Published on 2010-02-04T22:38:40Z Indexed on 2010/05/19 2:10 UTC
Read the original article Hit count: 749

Filed under:
|
|
|
|

I am developing an iPhone app that places multiple custom UIViews as subviews in a UIScrollView. The subviews are placed on top of each other as transparent views as each view has its own drawing routines that traces parts of the base view. The base view is a UIImageView that is typically a large image that I want the user to be able to pan and zoom in and out of.

The problem I am having is that when I zoom in and out of my UIScrollView, the subviews do not redraw themselves while the user is zooming. I can reposition and scale the subviews properly once the zoom is completed, but the user experience is less than desirable. I have not been able to find a way to either hide or redraw the subviews as the zoom is taking place to scale the subviews along with the ImageView.

Any ideas?

thanks!

Here is the code that I have implemented:

- (void)scrollViewDidEndZooming:(UIScrollView *)scrollView withView:(UIView *)view atScale:(float)scale {

 for (UIView *view in subViews)
 {
  [view updateView:scale];
 }
}

- (UIView *)viewForZoomingInScrollView:(UIScrollView *) scrollView {
 return imageView;
}

© Stack Overflow or respective owner

Related posts about iphone

Related posts about uiscrollview