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 6884205
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T05:28:42+00:00 2026-05-27T05:28:42+00:00

Overview I’m working on an iPhone game whose code I inherited from another developer.

  • 0

Overview

I’m working on an iPhone game whose code I inherited from another developer. The gaming grid is a UIScrollView having a contentSize of 1000×1000. The grid contains several elements drawn on the screen via OpenGL’s Texture2D class.

The UIScrollView scrolls in the direction opposite of that in which your finger is moving. The idea behind this is to simulate the act of “sifting” through the elements with your finger, as each element in the path of your touch is supposed to be affected/manipulated.

 

The Issue

The problem is that the scrolling of the UIScrollView triggers touchesCancelled, thus ending the touchesMoved calls that the game relies on to know which elements to manipulate. Even if my finger movement doesn’t visually trigger the view to scroll, moving my finger more than 10 pixels in distance triggers the touchesCancelled method, thus ending future touchesMoved calls until I lift my finger and start a new touch event.

I am confident that it’s the scrolling event that is triggering the touchesCancelled method, because if I set self.scrollingEnabled = NO; on the view, moving the finger on the screen continues to trigger touchesMoved as it should no matter how far I move my finger on the screen, touchesEnded gets called as expected when I lift my finger (after I’m done sifting through the elements), and each element in the path of my touch/swipe is indeed manipulated as desired. However, setting this property naturally prevents the desired scrolling of the game grid.

 

Failed Attempts to Fix

I have tried setting self.canCancelContentTouches = NO; in the initWithFrame method of the view, but touchesCancelled is still being triggered, oddly enough. Not sure why that is! Maybe I’ve got it in the wrong spot, but I’m not so sure that would even be the solution to my issue because the docs imply that such a setting would prevent scrolling anyway: “If the value of this property is NO, the scroll view does not scroll regardless of finger movement once the content view starts tracking.” Clearly that’s not the behavior I’m after, so that property doesn’t seem to be what I’m interested in after all. Though I’m still perplexed at why it still scrolled and called touchesCancelled, but I digress.

I’ve also added the method - (BOOL)touchesShouldCancelInContentView:(UIView *)view but it’s not getting called, even without setting self.canCancelContentTouches = NO; as the docs say that setting the canCancelTouches property to NO would indeed prevent the touchesShouldCancelInContentView method from being called: “The scroll view does not call this method if the value of the canCancelContentTouches property is NO.”. Though the docs seem unclear as to whether or not returning NO from this method would also prevent scrolling like the canCancelContentTouches = NO; setting would. If not, then this aught to be the ideal solution. Again though, I have no idea why this method isn’t even getting called, as the docs only mention that one property/setting that prevents it from being called, and it still didn’t get called even with that property not set to NO (thus defaulting to YES).

 

Where Do I Go From Here?

So now I’m at a loss. The fact is I still need touchesMoved to continue being called after the view has started scrolling. Is that at all possible? If not, what are my options here?

  • 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-27T05:28:43+00:00Added an answer on May 27, 2026 at 5:28 am

    I had exactly the same problem (and wasted a lot of time).
    Then I tried to set the cancelsTouchesInView property as soon as possible (I did it in viewDidLoad)… and it worked for me (as shown here)!

    - (void)viewDidLoad {
        [super viewDidLoad];
        /* other initializations */
        scrollView.panGestureRecognizer.cancelsTouchesInView = NO;
    }
    

    This works in iOS 5. Before iOS 5 you need to go through all the recognizers, find the panGestureRecognizer, and then set the property.
    So this should be a universal solution:

    - (void)viewDidLoad {
        [super viewDidLoad];
        /* other initializations */
        for (UIGestureRecognizer *gesture in scrollView.gestureRecognizers){
            if ([gesture isKindOfClass:[UIPanGestureRecognizer class]]){
            gesture.cancelsTouchesInView = NO;    
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a overview page containing a list with some links from which multiple
Overview I'm in the process of porting a simple utility app over from C#
Overview: I'm working on some windows service using Visual Basic 2010, which deployed on
Overview: I am trying to avoid a race condition with accessing an IndexedDB from
Overview: I am working on a project which involves a WCF and multiple types
Overview From time to time in jQuery I want to check a condition of
Overview of My Situation: My task is to read strings from a file, and
First a short overview of my code, i hope its understandable: I have a
Overview I am working on building a Kynetx ruleset that will find a bunch
Here is a overview of my code. User press a record button and it

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.