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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T01:53:28+00:00 2026-06-13T01:53:28+00:00

I am new to iOS programming, and I am having trouble with passing data

  • 0

I am new to iOS programming, and I am having trouble with passing data between view controllers.

I have a view controller that geocodes an annotation on a map view, and sets the address as the title of the annotation view. The annotation view has a callout button that pushes another view to the stack, which has a label, and I want the address that was geocoded to show up as the label. Here is some code:

This is where I drop the pin:

-(void)press:(UILongPressGestureRecognizer *)recognizer
{
    CGPoint touchPoint = [recognizer locationInView:worldView];
    CLLocationCoordinate2D touchMapCoordinate = [worldView convertPoint:touchPoint toCoordinateFromView:worldView];

    geocoder = [[CLGeocoder alloc]init];
    CLLocation *location = [[CLLocation alloc]initWithCoordinate:touchMapCoordinate
                                                    altitude:CLLocationDistanceMax
                                          horizontalAccuracy:kCLLocationAccuracyBest
                                            verticalAccuracy:kCLLocationAccuracyBest
                                                   timestamp:[NSDate date]];
    [geocoder reverseGeocodeLocation:location
                   completionHandler:^(NSArray *placemarks, NSError *error) {
                       NSLog(@"reverseGeocoder:completionHandler: called");
                       if (error) {
                          NSLog(@"Geocoder failed with error: %@", error);
                       }
                       if (placemarks && placemarks.count > 0)
                       {
                           CLPlacemark *place = [placemarks objectAtIndex:0];
                           _address = [NSString stringWithFormat:@"%@ %@, %@ %@", [place subThoroughfare], [place thoroughfare], [place locality], [place administrativeArea]];

                           if (UIGestureRecognizerStateBegan == [recognizer state]) {
                               _addressPin = [[MapPoint alloc]initWithCoordinate:touchMapCoordinate
                                                                        title:_address];
                           [worldView addAnnotation:_addressPin];
                       }
                   }
               }];
}

Here is the code for the view where I want the address to show up:

#import <UIKit/UIKit.h>
@class MapPoint;

@interface PinViewController : UIViewController <UINavigationControllerDelegate,     UIImagePickerControllerDelegate,UITextFieldDelegate>

{
    __weak IBOutlet UILabel *addressLabel;
}

@property (weak, nonatomic) IBOutlet UIImageView *imageView;
@property (strong, nonatomic) MapPoint *pin;

-(void)takePicture:(id)sender;
-(void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event;

@end

#import "PinViewController.h"
#import "MapPoint.h"

@interface PinViewController ()

@end

@implementation PinViewController

@synthesize imageView, pin;
-(void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];

    [addressLabel setText:[pin title]];

}

The class MapPoint has a title property and subtitle property. When the PinViewController is pushed to the top of the stack, I try to set the text of the label to the title of the pin, but the label does not show any text. Can someone help me out and tell me what I am missing? Your help is greatly appreciated.

  • 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-13T01:53:32+00:00Added an answer on June 13, 2026 at 1:53 am

    Just create property for the label and pass the label text from callout tapped method

    - (void)mapView:(MKMapView *)mapView annotationView:(MKPinAnnotationView *)view calloutAccessoryControlTapped:(UIControl *)control {
    
        Details *det=[[Details alloc]init];
        det.label.text=annotation.title;
        [self.navigationController pushViewController:det animated:YES];
        [det release];
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

new to IOS OpenGL programming. I have worked through a few tutorials that talk
I am new to iOS programming, i read the view controller programming guide but
I'm a bit new to programming for iOS, and I'm having some trouble linking
I'm a new iOS programming and I'm developing a simple iPhone game that needs
I am new to iOS programming. I see that there are functions defined in
I'm new on iOS programming. My situation is that I try inserting a row
I'm new to iOS programming and I am working on a easy project that
I'm fairly new to iOS programming, but have a basic understanding of it. I
I'm very new to IOS programming and i have doubt with NSThread. My problem
I'm new to iOS programming, I have a project going on and along with

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.