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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T09:58:29+00:00 2026-06-11T09:58:29+00:00

EDITED QUESTION: I’m trying to take annotations created in map view (with title/subtitle) and

  • 0

EDITED QUESTION:

I’m trying to take annotations created in map view (with title/subtitle) and push all annotations on my map to a tableview showing the list with title/subtitle.

I have a RegionAnnotation.h/.m NSObject file that works the reverse geocoding I need to populate the pins on my MapViewController. This works just fine. I do a long press which create a pin and the title and subtitle show up and the reverse geocoding works.

Now I want to push the pin data to a tableview list. I have tried calling the region annotation information within the cellForRowAtIndexPath and I use UITableViewCellStyleSubtitle in order to get the correct format for the cell to populate the title and subtitle. However when I call the following:

if (cell == nil){
    NSLog(@"if cell");
    cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier];
        }

CLPlacemark *pins = [self.annotations objectAtIndex:indexPath.row];
RegionAnnotation *annotation = [[RegionAnnotation alloc] initWithLocationIdentifier:(NSString *)pins];
cell.textLabel.text = annotation.title;

I only get the title, which is this case is “Location Reminder”, however, the subtitle information which is the address does not populate the table. All that shows is the text “subtitle”.

How do I populate the cell with both title and subtile information. I’ve been working on this for over a month and can’t seem to find a solution. Please help.

  • 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-11T09:58:30+00:00Added an answer on June 11, 2026 at 9:58 am

    Some comments on the latest code posted:

    CLPlacemark *pins = [self.annotations objectAtIndex:indexPath.row];
    RegionAnnotation *annotation = [[RegionAnnotation alloc] 
        initWithLocationIdentifier:(NSString *)pins];
    

    This doesn’t look right. The pins variable is declared as a CLPlacemark (which is suspicious in itself because CLPlacemark doesn’t conform to MKAnnotation so why is it in an “annotations” array?) and then it is being casted an NSString * which has no relationship to a CLPlacemark. The cast is not going convert pins into a string — it’s going to treat the data pointed to by pins as if it was a NSString (which it isn’t).

    There are too many other issues, questions and unknowns with the previous code that was posted as well.


    Instead, I’ll give an example of how you might pass the annotations that are on the map view to a table view and show the data in the cells…

    • In the PinListViewController (the one with the table view), we declare an NSArray property to receive and reference the annotations:

      //in the .h:
      //Don't bother declaring an ivar with the same name.
      @property (nonatomic, retain) NSArray *annotations;
      //in the .m:
      @synthesize annotations;
      
    • Next, in the MapViewController, in the place where you want to present/push/show the PinListViewController, the code would be something like this:

      PinListViewController *plvc = [[PinListViewController alloc] init...
      
      //pass the map view's annotations array...
      plvc.annotations = mapView.annotations;
      
      [self presentModalViewController:plvc animated:YES];  //or push, etc.
      
      [plvc release];  //remove if using ARC
      

      An important point here is that this example sends the entire annotations array. If you are showing the user’s current location using showsUserLocation = YES then the array will include that annotation as well. If you only want to send certain annotations, you’ll have to first build a new array containing the ones you want from the map view array and set plvc.annotations equal to that new array. A simple way to do that is to loop through the mapView.annotations and if an annotation is one you want to include, add it to the new array using addObject. Another possible issue with using the map view’s annotations array directly is that if the annotations on the map change (are added/removed) while the table view is still showing the annotations list, it will go out of sync and may cause run-time range exceptions. To avoid that, if necessary, you could set plvc.annotations to a copy of the map view’s annotations array (ie. [mapView.annotations copy]).

    • In PinListViewController, in the numberOfRowsInSection method:

      return self.annotations.count;
      
    • In PinListViewController, in the cellForRowAtIndexPath method:

      //typical dequeue/alloc+init stuff here...
      //assume cell style is set to UITableViewCellStyleSubtitle
      
      id<MKAnnotation> annotation = [self.annotations objectAtIndex:indexPath.row];
      cell.textLabel.text = annotation.title;
      cell.detailTextLabel.text = annotation.subtitle;
      
      return cell;
      

      The annotation is declared as id<MKAnnotation> so it will work with any type of annotation since the example only needs to show the standard title and subtitle properties. If you needed to show custom properties you may have in your custom annotation class, you would use isKindOfClass to check if annotation is of that type and then you can cast it to that custom class and reference the custom properties.

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

Sidebar

Related Questions

EDITED because question is about same program. I'm trying to take the top fifty
EDIT: Based on evolution of the problem, I edited this question. First of all,
Edited Question: Trying to use a .dll file from Java using JNA. I've managed
Edited question to make it a bit more specific. Not trying to base it
Edited Question: This should be clear. using System; namespace UpdateDateTimeFields { class Program {
I edited the question so it would make more sense. I have a function
I edited this question after i found a solution... i need to understand why
The question and description has been edited to make the user understand well what
Warning: This question has been heavily edited. I tried my best to guess the
NB: This question has been extensively edited to make it more relevant, for completeness

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.