objective c - Zooming UIImage in a UIScrollView -
i have custom class implements uiscrollview.
i created 1 uiimageview , add together subview of uiscrollview. scrolls vertically , horizontally perfectly, seems ignoring zooming stuff. here code:
- (void) setupboard { // add together board uiimageview *imageholder = [[uiimageview alloc] initwithimage:[uiimage imagenamed:@"grid.jpg"]]; [self addsubview:imageholder]; self.contentsize = cgsizemake(imageholder.frame.size.width, imageholder.frame.size.height); self.indicatorstyle = uiscrollviewindicatorstylewhite; self.maximumzoomscale = 5.0; self.minimumzoomscale = 0.2; self.zoomscale = 0.7; self.clipstobounds = yes; }
how zoom using standard pinch gestures? help appreciated. thanks!
from uiscrollview class reference overview:
the uiscrollview
class can have delegate must adopt uiscrollviewdelegate
protocol. zooming , panning work, delegate must implement both viewforzoominginscrollview:
, scrollviewdidendzooming:withview:atscale:
; in addition, maximum (maximumzoomscale
) , minimum (minimumzoomscale
) zoom scale must different.
i suspect either haven't assigned delegate scroll view, or delegate doesn't implement both of methods.
objective-c uiscrollview
No comments:
Post a Comment