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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T07:49:05+00:00 2026-06-14T07:49:05+00:00

I have an MKMapView, and I’m trying to set the map, so that when

  • 0

I have an MKMapView, and I’m trying to set the map, so that when you first load the application it goes to a user set location, and if the user hasn’t set one, to a default one. The problem is that it always seems to go to 0 latitude, 0 longitude.

-(void) viewDidLoad {

  [worldView setShowsUserLocation:YES];

  double longitude = [[NSUserDefaults standardUserDefaults] doubleForKey:WhereamiNewLongPrefKey];

  double latitude = [[NSUserDefaults standardUserDefaults] doubleForKey:WhereamiNewLatPrefKey];

  CLLocationCoordinate2D savedLoc = CLLocationCoordinate2DMake(latitude, longitude);

  MKCoordinateRegion region = MKCoordinateRegionMakeWithDistance(savedLoc, 250, 250);

  NSLog(@"latitude :%f", region.center.latitude);      
  NSLog(@"longitude :%f", region.center.longitude);

  [worldView setRegion:region animated:YES];
}

I’ve tried setting setShowUserLocation to NO, but that doesn’t work. I know it’s reading the correct region, because the NSLog is outputing the default latitude, but the map insists on going to somewhere in China…

I’ve also tried setting the region in mapView:didUpdateUserLocation:, but still the same result.

What am I doing wrong?

EDIT: I added the NSLog to output the longitude as well. The output is:

2012-11-14 09:50:30.699 Whereami[34256:13d03] latitude :20.516700
2012-11-14 09:50:30.699 Whereami[34256:13d03] longitude :99.900000
  • 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-06-14T07:49:06+00:00Added an answer on June 14, 2026 at 7:49 am
    CLLocationCoordinate2D theCoordinate;
    theCoordinate.latitude = 20.516700;
    theCoordinate.longitude = 99.900000;
    
    MKCoordinateRegion viewRegion = MKCoordinateRegionMakeWithDistance(theCoordinate, 1000, 1000);
    MKCoordinateRegion adjustedRegion = [self.mapView regionThatFits:viewRegion];  
    [self.mapView setRegion:adjustedRegion animated:YES];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a MKMapView and in the Map View Show User Location is set.
I have an MKMapView that's supposed to track the user's location using a custom
I have a MKMapView & I use it to display user's current location. It
I have an MKMapView which allows the user to scroll the map around. Later,
I have a MKMapView (obviously), that shows housing locations around the user. I have
I have an application that uses MKMapView and at some point in the app
I have a tabbar application and on the first tab I have a MKMapView
I have an MKMapView with an MKUserTrackingBarButtonItem . The user's current location should only
I have a MKMapView annotation object that has a right callout accessory detail disclosure
I want to have a MKMapView with an two different overlays. First, I have

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.