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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T14:04:02+00:00 2026-05-15T14:04:02+00:00

I have an MKMapView which allows the user to scroll the map around. Later,

  • 0

I have an MKMapView which allows the user to scroll the map around. Later, I want to get the latitude and longitude of the point at the center of the map, but can’t find an easy way to do it. At the moment I’m trying something like:

CLLocationCoordinate2D centre = [locationMap convertPoint:locationMap.center toCoordinateFromView:locationMap];
txtLatitude.text = [NSString stringWithFormat:@"%f",centre.latitude];
txtLongitude.text = [NSString stringWithFormat:@"%f",centre.longitude];

But it’s not working – both latitude and longitude both come out as zero. I’d be grateful for any ideas anyone might have!

==============

— Update 1 —

Oh. If I add the:

NSLog(@"%@", locationMap);

line as suggested below, the log shows “(null)”. I’ve got the following in my header (amongst other things):

#import <UIKit/UIKit.h>
#import <MapKit/MapKit.h>
#import <CoreLocation/CoreLocation.h>

IBOutlet MKMapView *locationMap;

@property (nonatomic, retain) IBOutlet MKMapView *locationMap;

and the following in my methods file:

@synthesize locationMap;

This is compiling without any warnings or errors at present. Starting to wonder if I’ve missed something obvious?

  • 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-15T14:04:03+00:00Added an answer on May 15, 2026 at 2:04 pm

    What about the centerCoordinate property?

    i.e.

    CLLocationCoordinate2D centre = [locationMap centerCoordinate];
    

    If the centerCoordindate property is all 0, check that you’ve got a valid locationMap pointer – objective-c will let you send messages to nil without any errors!

    Try NSLog(@"%@", locationMap); – if that outputs nil, you’ve probably forgotten to connect the mapLocation to a MKMapView in Interface Builder 😉

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

Sidebar

Related Questions

I have an app which is providing a zoomable MKMapView to the user. I
I am creating an application which displays map using MKMapView control. I have a
I have two UITextFields which users can enter in a latitude and longitude, these
My application uses a MapView which will display multiple places. I have the latitude
I have a MKMapView & I use it to display user's current location. It
I want to have a MKMapView with an two different overlays. First, I have
I have a ViewController (with a MKMapView) which is pushed into, because of the
I have a working user-preferences screen which is defined in user_prefs.xml. The xml is
I have MKMapView with MKPlacemark on it. When showing the map, I'm showing place
I have a map view and there are 10 store locations which data comes

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.