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

  • Home
  • SEARCH
  • 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 801525
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T23:27:17+00:00 2026-05-14T23:27:17+00:00

I feel like I should know this but I’ve been stumped for hours now

  • 0

I feel like I should know this but I’ve been stumped for hours now and I’ve run out of ideas.

The theory is simple, the user manipulates the zoom and positioning in a scrollview using a pinch. If they hold that pinch for a short period of time then the scrollview records the zoom level and content offsets.

So I thought I’d start a performSelector:withObject:withDelay on the scrollViewDidZoom delegate method. If it expires then I record the settings. I delete the scheduled call every time scrollViewDidZoom is called and when the pinch gesture finishes.

This is what I have:

- (void)scrollViewDidZoom:(UIScrollView *)scrollView{
    NSLog(@"resetting timer");
    [NSObject cancelPreviousPerformRequestsWithTarget:self selector:@selector(positionLock) object:nil];

    [self performSelector:@selector(positionLock) withObject:nil afterDelay:0.4];               
}

-(void)positionLock{
    NSLog(@"position locked ");
}

- (void)scrollViewDidEndZooming:(UIScrollView *)scrollView withView:(UIView *)view atScale:(float)scale{

    NSLog(@"deleting timer");
    [NSObject cancelPreviousPerformRequestsWithTarget:self selector:@selector(positionLock) object:nil];
}

This is the output:

2010-05-19 22:43:01.931 resetting timer
2010-05-19 22:43:01.964 resetting timer
2010-05-19 22:43:02.231 resetting timer
2010-05-19 22:43:02.253 resetting timer
2010-05-19 22:43:02.269 resetting timer
2010-05-19 22:43:02.298 resetting timer
2010-05-19 22:43:05.399 deleting timer

As you can see the delay between the last and second last events should have been more than enough for the delayed selector call to execute.

If I replace performSelector:withObject:withDelay with plain old performSelector: I get this:

2010-05-19 23:08:30.333 resetting timer
2010-05-19 23:08:30.333 position locked
2010-05-19 23:08:30.366 resetting timer
2010-05-19 23:08:30.367 position locked
2010-05-19 23:08:30.688 deleting timer

Which isn’t what I want but serves to show that it’s only the delay that’s causing it to not function, not something to do with the selector not being declared in the header, being misspelt or any other reason.

Any ideas as to why it’s not working?

  • 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-14T23:27:18+00:00Added an answer on May 14, 2026 at 11:27 pm

    I think that timer events are ignored during tracking (when a finger is down in order to scroll or zoom). You might have to perform the selector in a different mode (see [NSObject performSelector:withObject:afterDelay:inModes:]). Specifically, try using @[NSRunLoopCommonModes] for the mode.

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

Sidebar

Related Questions

I feel like I should know this, but I haven't been able to figure
I feel like this is something I should already know, but I'm just not
I feel like I should know the answer to this, but I don't. What
I feel like I should know this, but for some reason.... What is the
I feel like this should be a no brainer, but clearly I'm missing something...
I feel like this should be obvious to me, but for some reason I
I asked this as part of another question but feel like it should have
Ok, I feel like this should be obvious but I'm just not seeing things.
I've been having issues with this for a little while now. I feel like
I feel like this should have a simple answer, but I can't find 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.