I have a photo gallery application, you have a problem preparing for ios 8. Images are displayed in the UIPageViewController and each page has a view with a custom UIScrollView class. This is exactly the same as the Apples PhotoScroller sample ( https://developer.apple.com/library/ios/samplecode/PhotoScroller/Introduction/Intro.html )
I added UITapGestureRecognizer for double tap. Here is the code I use to scale:
- (void)scrollViewDoubleTapped:(UITapGestureRecognizer*)recognizer { if (self.minimumZoomScale == self.maximumZoomScale) return; if (self.zoomScale == self.minimumZoomScale) didDoubleTap = NO; CGPoint pointInView = [recognizer locationInView:_zoomView]; CGFloat newZoomScale; if (!didDoubleTap && self.zoomScale <= self.minimumZoomScale) { newZoomScale = self.zoomScale * 2.5f; newZoomScale = MIN(newZoomScale, self.maximumZoomScale); didDoubleTap = YES; } else { newZoomScale = self.minimumZoomScale; didDoubleTap = NO; } CGSize scrollViewSize = self.bounds.size; CGFloat w = scrollViewSize.width / newZoomScale; CGFloat h = scrollViewSize.height / newZoomScale; CGFloat x = pointInView.x - (w / 2.0f); CGFloat y = pointInView.y - (h / 2.0f); CGRect rectToZoomTo = CGRectMake(x, y, w, h); [self zoomToRect:rectToZoomTo animated:YES]; }
This works when I run it on xcode 5.1 perfectly, like in any other photo apps. But when I run / create it on xcode 6 gm, the animation for enlargement becomes tougher. First, the content offset is set to a future location, and then it increases. Thus, images jump up or down.
Has anyone had this problem before or had any ideas?
source share