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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T13:30:52+00:00 2026-05-30T13:30:52+00:00

I currently have a map displaying 10 or so co ordinates.The map gets the

  • 0

I currently have a map displaying 10 or so co ordinates.The map gets the users location and centers on it as soon as it is opened. When panning the page or zooming different levels it eventually resets and centers in on the first position of the user.I have tried “stopupdating location” and Animated as “NO”.I can not get it to stay in positon when the user scrolls the map.

- (void)viewDidLoad {
[super viewDidLoad];
self.petrolMap.delegate = self;
self.location = [[CLLocationManager alloc] init];
[location setDelegate:self];
[location setDistanceFilter:0];  // Do not apply a distance filter to the map
[location setDesiredAccuracy:kCLLocationAccuracyBest]; // Use the best accuracy possible when displaying the map
petrolMap.delegate=self; // Display on "Petrol Map" , the mapview for the application}



-(void) mapView:(MKMapView *)mapView didUpdateUserLocation:(MKUserLocation *)userLocation{MKCoordinateRegion mapRegion;
mapRegion.center = petrolMap.userLocation.coordinate;
mapRegion.span.latitudeDelta=0.02;
mapRegion.span.longitudeDelta=0.02;
[petrolMap setRegion:mapRegion animated:NO];}
  • 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-30T13:30:54+00:00Added an answer on May 30, 2026 at 1:30 pm

    Your ‘location’ is a location manager, when it works out where you are it’ll send its delegate

    locationManager:didUpdateToLocation:fromLocation:
    

    which you don’t seem to have, so all those settings you’re doing to ‘location’ are wasted (as far as the code you’ve given us, it may be useful elsewhere) and telling it to stop tracking the user is of no use.

    “(void) mapView:(MKMapView *)mapView didUpdateUserLocation:(MKUserLocation *)userLocation{MKCoordinateRegion mapRegion;” is what petrolMap is sending to its delegate. Somewhere you must have set petrolMap to track the user, it can be done in the .xib.

    Anyway, to stop petrolMap sending messages make sure you run

    [petrolMap setUserTrackingMode:MKUserTrackingModeNone animated:NO];
    

    Some extra notes:

    • Within didUpdateUserLocation you don’t need to refer to petrolMap directly because the mapView parameter is set to which ever MKMapView sent the message.

    • Also within didUpdateUserLocation you are using petrolMap’s userLocation instead of the parameter userLocation, and even building your region. The entire code for that function could be one line

      [mapView setRegion:mapRegion animated:NO];
      
    • ‘Animated’ controls how the change in region is done. Yes means it will slide between locations, No means it will snap from one to the other instantly, either way the map will move to the new region.

    • Your viewDidLoad method could be cut to two lines like follows

      [super viewDidLoad];
      self.petrolMap.delegate = self;
      

    Addendum:

    locationManager:didUpdateToLocation:fromLocation 
    

    is deprecated in iOS6.

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

Sidebar

Related Questions

Currently I have a page displaying 3 Google Maps that are generated by JavaScript,
Currently, I have: map.resources :users do |user| user.resources :blogs end How do I turn
I currently have a Checkbox under my settings.xaml page, which the users is to
I have a servlet running in an Oracle OCCAS server. Currently I map some
I currently have a map mashup that has locations that I'm populating from my
Currently I have a map that prints out the following map<string, map<int,int> > mapper;
I currently have a routes.rb file that looks like this: map.resources :profiles do |profile|
I have two activities one displaying map view and another listview, the main objective
I currently have a Google map that geocodes multiple markers on the fly but
I have my map working and displaying correctly. I trying to get it 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.