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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T18:37:56+00:00 2026-06-10T18:37:56+00:00

CLLocation *userLoc = mapView.userLocation.location; CLLocationCoordinate2D userCoordinate = userLoc.coordinate; NSLog(@user latitude = %f,userCoordinate.latitude); NSLog(@user longitude

  • 0
CLLocation *userLoc = mapView.userLocation.location;
    CLLocationCoordinate2D userCoordinate = userLoc.coordinate;

    NSLog(@"user latitude = %f",userCoordinate.latitude);
    NSLog(@"user longitude = %f",userCoordinate.longitude);

    mapView.delegate=self;

What does the above code do all in all? no need for a line by line explanation as I understand the lingo.. just unsure of what this code is used for..

  • 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-10T18:37:58+00:00Added an answer on June 10, 2026 at 6:37 pm

    First, you should learn how to dig through apple docs to answer these type of questions. I usually start by searching for XXX class reference or XXX developer guide.

    mapview is an MKMapView object. See here: http://developer.apple.com/library/ios/#DOCUMENTATION/MapKit/Reference/MKMapView_Class/MKMapView/MKMapView.html

    userLocation returns the user’s current location. From those docs:

    userLocation
    The annotation object representing the user’s current location. (read-only)
    
    @property(nonatomic, readonly) MKUserLocation *userLocation
    

    The code then gets the coordinates of the user location and logs out the latitude and longitude.

    Finally, setting the delegate to self means this class will implement the callbacks of the MKMapViewDelegate protocol. From those docs:

    delegate
    The receiver’s delegate.
    
    @property(nonatomic, assign) id<MKMapViewDelegate> delegate
    Discussion
    A map view sends messages to its delegate regarding the loading of map data and changes in     the portion of the map being displayed. The delegate also manages the annotation views used to highlight points of interest on the map.
    
    The delegate should implement the methods of the MKMapViewDelegate protocol.
    

    See here for what a delegate is: What exactly does delegate do in xcode ios project?

    So the callbacks allow you to interject code into the pipeline execution of the map view and to also provide data like viewForAnnotation.

    And here is the docs on the MKMapVeiwDelegate (the callbacks for you mapview):

    http://developer.apple.com/library/ios/#DOCUMENTATION/MapKit/Reference/MKMapViewDelegate_Protocol/MKMapViewDelegate/MKMapViewDelegate.html#//apple_ref/occ/intf/MKMapViewDelegate

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

Sidebar

Related Questions

- (NSString *) geocodeAddressFromCoordinate:(CLLocationCoordinate2D)coordinate { CLLocation *location = [[CLLocation alloc]initWithLatitude:coordinate.latitude longitude:coordinate.longitude]; __block NSMutableString *
int someFunction (CLLocation *currentLocation) { double latitude = 12.3f; double longitude = 22.5f; CLLocationDistance
How to get current latitude & longitude without - (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation*)newLocation fromLocation:(CLLocation *)oldLocation
I have a mapView outlet on my view (MKMapViewDelegate) with Shows user location enabled.
I have got CLLocation object which contains current location of user and I have
my partial code to store location with image. CLLocation *location = self.filteredLocation ; NSNumber
I am getting latitude and longitude using CLLocation. I want to know how I
I need help with showing the user's location on my MapView. I have done
I'm trying to convert CLLocation latitude / longitude to a string. I can successfully
I have an CLLocation which is my userLocation, now in another class 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.