UIScrollView - photo viewer like usage
UIScrollView - photo viewer like usage
- Subject: UIScrollView - photo viewer like usage
- From: Ruotger Skupin <email@hidden>
- Date: Tue, 10 Feb 2009 12:55:59 +0100
Hi,
this is going to sound like an angry rant but actually it isn't. I'm
simply a bit frustrated...
I have been trying to use UIScrollView to build an Photo app-like
image viewer. The view is supposed to show photos with swiping between
them, zooming and rotating with interface rotation.
It seems this is impossible. When you add more than one subview to
UIScrollView, zooming seems to be broken beyond repair with strange
behaviour all over the place, no control over the subviews while
zooming and weird whizzing of views when the zooming ends. It's hard
to post Radar bugs here, because there is only little documentation of
what should actually happen or what can be done when
- (UIView *)viewForZoomingInScrollView:(UIScrollView *)scrollView
- (void)scrollViewDidEndZooming:(UIScrollView *)scrollView withView:
(UIView *)view atScale:(float)scale
is called.
So my questions:
Has anyone done this successfully (with UIScrollView)?
Is it better to re-implement all this with layers to have more control
over everything?
To Apple people:
Does it make sense to spend a support incident on this or is it just a
waste of everyone's time.
Regards and no offence meant
Ruotger
P.S.: to see what I mean download the Scrolling sample and add these
methods to MyViewController:
- (UIView *)viewForZoomingInScrollView:(UIScrollView *)scrollView
{
CGPoint offset = scrollView.contentOffset;
int imageIndex = (int)(floorf(offset.x / kScrollObjWidth));
if (imageIndex >= 0 && imageIndex < [[scrollView1 subviews] count])
return [[scrollView1 subviews] objectAtIndex:imageIndex];
return nil;
}
- (void)scrollViewDidEndZooming:(UIScrollView *)scrollView withView:
(UIView *)view atScale:(float)scale
{
}
// and add this to -[MyViewController viewDidLoad]:
scrollView1.minimumZoomScale = 1;
scrollView1.maximumZoomScale = 3;
scrollView1.delegate = self;
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden