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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T08:04:50+00:00 2026-05-23T08:04:50+00:00

I am trying to create a map app where the user can tag a

  • 0

I am trying to create a map app where the user can tag a map with a photo, comment or video, but I am having a problem putting an annotation on the map.

My scenario is like this:

On the 1st page, the user can see three button with the map (1.photo, 2.comment and 3.video). When he wants to tag the map by clicking on the photo button. I use cammerView class, which gives three more buttons (1.take photo, 2.choose photo and 3.use photo); after taking a photo he has a choice of using photo or not. If he wants use this photo the screen must move to the map page, and the annotation must drop.

I am getting problem. I cannot figure out how to drop the annotation on user’s map at the current location. This annotation must drop after the clicking the use button which on the photo class.

I also tried this sample application, but in my case I need to have the annotation drop on the map from a button that is on the same page. How can I make this work?

  • 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-23T08:04:51+00:00Added an answer on May 23, 2026 at 8:04 am

    Code from Class1.m (Where Your button is touched):

    #Class1.m

    - (void) trackImageOnMapButtonTouched
    {
        MapView *tempView =[[MapView alloc] initWithNibName:@"MapView" bundle:[NSBundle mainBundle]];
        self.moveToMapView=tempView;
        [tempView release];
        int iId=[mainSlideShowImageView tag];
        self.moveToMapView.fromFlag_imageId=[NSString stringWithFormat:@"%d",iId];
        self.moveToMapView.slideShowView_imageOnSlide=[NSString stringWithFormat:@"%d",[mainSlideShowImageView tag]];
        NSLog(@"self.moveToMapView.slideShowView_imageOnSlide=%@",self.moveToMapView.slideShowView_imageOnSlide);
        [self.view addSubview:moveToMapView.view];
    }
    

    #Class2.m

    - (void) viewDidLoad
    {
        self.lattitudeArray=[[NSMutableArray alloc] init];
        self.longitudeArray=[[NSMutableArray alloc] init];
        MKCoordinateRegion region;
        MKCoordinateSpan span;
    
        CLLocationCoordinate2D location;
    
        span.latitudeDelta=2.0;
        span.longitudeDelta=2.0;
        location.latitude=43.25f;
        location.longitude=11.00f;
        region.span=span;
        region.center=location;
    
    
        addAnnotation = [[MapViewAnnotation alloc] initWithLocation:location withTitle:[NSString stringWithFormat:@"Tuscany"] withSubTitle:[NSString stringWithFormat:@"Italy"] withImage:[UIImage imageNamed:@"1.jpg"]];
        addAnnotation.mTitle=[NSString stringWithFormat:@"Tuscany"];
        addAnnotation.mSubTitle=[NSString stringWithFormat:@"Italy"];
        [mapView addAnnotation:addAnnotation];
        [mapView setRegion:region animated:TRUE];
        [mapView regionThatFits:region];
        mapView.mapType = MKMapTypeHybrid;   // also MKMapTypeSatellite or MKMapTypeHybrid
    }
    
    
    - (MKAnnotationView *) mapView:(MKMapView *)mapView viewForAnnotation:(id <MKAnnotation>) annotation
    {
    
        MKPinAnnotationView *annView=[[MKPinAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:@"currentloc"];
        annView.pinColor = MKPinAnnotationColorPurple;
        annView.animatesDrop=TRUE;
        annView.canShowCallout = YES;
        annView.calloutOffset = CGPointMake(-5, 5);
    
    
        NSString *imageName=[NSString stringWithFormat:@"%@.jpg",self.fromFlag_imageId];
        NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
        NSString *documentsDirectory = [paths objectAtIndex:0];
        NSString *fullImgNm=[documentsDirectory stringByAppendingPathComponent:[NSString stringWithString:imageName]];
        UIImage *actualImage=[UIImage imageWithContentsOfFile:fullImgNm];
    
        CGSize annImgSize;
        annImgSize.width=60;
        annImgSize.height=30;
        UIImage *locationImage=[self resizeImage:actualImage withSize:annImgSize];
        [rightButton setImage:locationImage forState:UIControlStateNormal];
        [rightButton addTarget:self
                        action:@selector(annotationPinClicked:)
              forControlEvents:UIControlEventTouchUpInside];
        annView.leftCalloutAccessoryView=rightButton;
        return annView;
    }
    

    And here last Supportive Class:

    .h

    #import <Foundation/Foundation.h>
    #import <MapKit/MapKit.h>
    @interface MapViewAnnotation : NSObject <MKAnnotation>
    {
        CLLocationCoordinate2D coordinate;
        NSString *mTitle;
        NSString *mSubTitle;
    }
    
    @property (nonatomic, retain) NSString *mTitle;
    @property (nonatomic, retain) NSString *mSubTitle;
    -(id)initWithLocation:(CLLocationCoordinate2D)location withTitle:(NSString *)title withSubTitle:(NSString *)subTitle withImage:(UIImage *)locationImage;
    //- (CLLocationCoordinate2D)initWithLocation:(CLLocationCoordinate2D) location;
    
    
    @end
    

    .m:

    #import "MapViewAnnotation.h"
    
    @implementation MapViewAnnotation
    
    @synthesize coordinate;
    @synthesize mTitle,mSubTitle;
    
    -(id)initWithLocation:(CLLocationCoordinate2D)location withTitle:(NSString *)title withSubTitle:(NSString *)subTitle withImage:(UIImage *)locationImage
    {
        coordinate.latitude = location.latitude;
        coordinate.longitude = location.longitude;
        return self;
    }
    
    -(NSString *)title
    {
        return mTitle;
    }
    
    -(NSString *)subtitle
    {
        return mSubTitle;
    }
    
    - (void) dealloc{
        [mTitle release];
        [mSubTitle release];
        [super dealloc];
    }
    
    @end
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

im trying to create a show on map section in my app, but for
i've been trying to create a map-related android app, but i realized that the
Trying to create a user account in a test. But getting a Object reference
I am trying to create a REST API for my app. The map.connect_resource :book
i am having no problem at all compiling/debugging my web app, but when i
Trying to create a Django app based off the tutorial but using a different
I was trying to create an app using Bing Map. in which i need
I'm trying to create a map, where the key is an int , and
I am trying to create a wpf control that will display a map image
I'm trying create a bot which automatically likes Facebook posts. Using Mechanize I can

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.