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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T17:51:35+00:00 2026-05-28T17:51:35+00:00

I want to determine if a user has scrolled more than a certain percentage

  • 0

I want to determine if a user has scrolled more than a certain percentage of the map then disable centering of the map from the user location (similar to how the Maps app works).

I’m not sure which methods to make use of.

I think it would be straightforward to create a rectangle and see if the rectangle contains the current center point, however I have to target IOS 3, so I can’t make use of many of the newer Mapkit apis.

I’ve tried futzing with CLLocation, and using distanceFrom, between the current mapcenter, and the users location, but I’m trying to figure out if that distance is a certain percentage.

  • 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-28T17:51:36+00:00Added an answer on May 28, 2026 at 5:51 pm

    I personally find it more helpful when someone can post a snippet of code versus general prose about how one might go about this. Here’s what I came up with- roughly hacked out to simply better answer this question:

    In a header file I have:

    #define SCROLL_UPDATE_DISTANCE          80.00
    

    and in my view (that is both a delegate for CLLocationManagerDelegate, MKMapViewDelegate):

    // this method is called when the map region changes as a delegate of MKMapViewDelegate
    - (void)mapView:(MKMapView *)mapView regionDidChangeAnimated:(BOOL)animated
    {
        NSLog(@"regionDidChangeAnimated");
        MKCoordinateRegion mapRegion;   
        // set the center of the map region to the now updated map view center
        mapRegion.center = mapView.centerCoordinate;
    
        mapRegion.span.latitudeDelta = 0.3; // you likely don't need these... just kinda hacked this out
        mapRegion.span.longitudeDelta = 0.3;
    
        // get the lat & lng of the map region
        double lat = mapRegion.center.latitude;
        double lng = mapRegion.center.longitude;
    
        // note: I have a variable I have saved called lastLocationCoordinate. It is of type
        // CLLocationCoordinate2D and I initially set it in the didUpdateUserLocation
        // delegate method. I also update it again when this function is called
        // so I always have the last mapRegion center point to compare the present one with 
        CLLocation *before = [[CLLocation alloc] initWithLatitude:lastLocationCoordinate.latitude longitude:lastLocationCoordinate.longitude];
        CLLocation *now = [[CLLocation alloc] initWithLatitude:lat longitude:lng];
    
        CLLocationDistance distance = ([before distanceFromLocation:now]) * 0.000621371192;
        [before release];
        [now release];
    
        NSLog(@"Scrolled distance: %@", [NSString stringWithFormat:@"%.02f", distance]);
    
        if( distance > SCROLL_UPDATE_DISTANCE )
        {
            // do something awesome
        }
    
        // resave the last location center for the next map move event
        lastLocationCoordinate.latitude = mapRegion.center.latitude;
        lastLocationCoordinate.longitude = mapRegion.center.longitude;
    
    }
    

    Hope that sends you in the right direction.

    distanceFromLocation is iOS 3.2 and later.
    initWithLatitude is iOS 2.0 and later.
    MKCoordinateRegion is iOS 3.0 and later.
    MKMapView centerCoordinate is iOS 3.0 and later.

    Also- please feel free to jump in and set me straight where I’ve erred. I’m figuring all of this out myself- but this is working fairly well for me so far.

    Hope this helps someone.

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

Sidebar

Related Questions

I want to determine whether the currently connected database user has permissions to create
I want to programmatically determine if the current user (or process) has access to
I want to use this page to determine if the user has either updated
I want to make a function to determine if a user, whose ID is
I'm re-writing a website from the ground up for azure. Each user has ownership
I need a way to determine is a User has a Project. My User
I am using an ActionFilter to determine if a user has access to a
I want to use Google's jQuery CDN so that the user has the best
I have a WPF Window, and I want to determine when a user finishes
I want to write a simple program that determines whether the number the user

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.