Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7410427
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T06:13:59+00:00 2026-05-29T06:13:59+00:00

How do I implement pinch to zoom to a parallax scrolling node ?

  • 0

How do I implement pinch to zoom to a parallax scrolling node?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T06:13:59+00:00Added an answer on May 29, 2026 at 6:13 am

    Here’s the solution:

    - (void)handlePitchZoom:(NSSet *)touches withEvent:(UIEvent *)event {
    
        UITouch* touch1 = [[[event allTouches] allObjects] objectAtIndex:0];
        UITouch* touch2 = [[[event allTouches] allObjects] objectAtIndex:1];
    
        // calculate scale value
        double prevDistance = ccpDistance([touch1 previousLocationInView:[touch1 view]], [touch2 previousLocationInView:[touch2 view]]);
        double newDistance  = ccpDistance([touch1 locationInView:[touch1 view]], [touch2 locationInView:[touch2 view]]); 
    
        CGFloat relation = newDistance / prevDistance;
        CGFloat newScale = self.scale * relation;
    
        if ((newScale >= minScale) && (newScale <= maxScale)) {
    
            CGPoint touch1Location = [parallaxNode convertTouchToNodeSpace:touch1];
            CGPoint touch2Location = [parallaxNode convertTouchToNodeSpace:touch2];
    
            // calculate center point between two touches
            CGPoint centerPoint = ccpMidpoint(touch1Location, touch2Location);
    
            // store center point location (ScrollableView space)
            CGPoint centerPointInParentNodeSpace = [self convertPoint:centerPoint fromNode:parallaxNode];
            CGPoint oldPoint = ccp(centerPointInParentNodeSpace.x * (self.scale), centerPointInParentNodeSpace.y * (self.scale));
            self.scale = newScale;
    
            CGPoint newPoint = ccp(centerPointInParentNodeSpace.x * (self.scale), centerPointInParentNodeSpace.y * (self.scale));
            CGPoint diff = ccp(oldPoint.x - newPoint.x , oldPoint.y - newPoint.y);
    
            [parallaxNode setPosition:ccp(parallaxNode.position.x + (diff.x*(1/self.scale)), parallaxNode.position.y + (diff.y*(1/self.scale)))];
        }
    

    Hope it will help someone…

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

All, I've extended the ImageView in order to implement pinch and zoom scaling on
My layout contains buttons, textviews, etc. Is it possible to implement pinch zoom in
I have been trying to implement pinch zoom/in-out for PhotoView (a UIImageView instance) using
I am trying to implement pinch zoom and it is working but when i
I'm trying to implement Pinch Zoom in my app using a 2d camera. I
Need to implement Image processing effects like Blur, Black & White, Pinch Zoom in
I am following Apple's ScrollSuite example, however pinch to zoom is not working. I
I am trying to implement a 2-finger pinch and expand (or enlarge) on a
I've got a custom NSView and I want to receive the pinch to zoom
I am trying to implement multi touch zoom in and zoom out functionality to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.