Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi all,
Vanilla are planning an update to the site on April 24th (next Wednesday). It is a major PHP8 update which is expected to boost performance across the site. The site will be down from 7pm and it is expected to take about an hour to complete. We appreciate your patience during the update.
Thanks all.

How do I link Xcode map annotations callout to an info page?

Options
  • 18-09-2014 11:26am
    #1
    Registered Users Posts: 494 ✭✭


    At the moment I am creating a Map with annotations in Xcode. I'm also using Xcode 4 at the moment due to code I copied from an old source.

    Here's a link:
    http://youtu.be/B5RfXxQWjL8
    which I have worked from. In the video at 14:10 he clicks the annotation action button however no callout page pops up.

    I am sure the answer is simple but how do I create an information page and then how do I link each annotation to have a different callout associated action to the information page?

    The guy who made the video also put the source code online which is handy.
    https://www.sendspace.com/file/1unim1

    I may also include below the code so far which actually has minimal changes thus far.

    Code below:

    #import "AnnotationViewController.h"
    #import "Annotation.h"

    @implementation AnnotationViewController
    @synthesize mapView;

    -(void)viewDidLoad {

    [super viewDidLoad];
    [mapView setMapType:MKMapTypeStandard];
    [mapView setZoomEnabled:YES];
    [mapView setScrollEnabled:YES];
    [mapView setDelegate:self];


    // Chapel of Isolde
    MKCoordinateRegion ChapelofIsolde = { {0.0, 0.0} , {0.0, 0.0} };
    ChapelofIsolde.center.latitude = 53.3573373;
    ChapelofIsolde.center.longitude = -6.3622526;
    ChapelofIsolde.span.longitudeDelta = 4.02f;
    ChapelofIsolde.span.latitudeDelta = 4.02f;
    [mapView setRegion:ChapelofIsolde animated:YES];

    Annotation *ann1 = [[Annotation alloc] init];
    ann1.title = @Chapel of Isolde;
    ann1.subtitle = @Legen of Tristen & Isolde;
    ann1.coordinate = ChapelofIsolde.center;
    [mapView addAnnotation: ann1];


    // Clonmacnoise
    MKCoordinateRegion Clonmacnoise = { {0.0, 0.0} , {0.0, 0.0} };
    Clonmacnoise.center.latitude = 53.326277;
    Clonmacnoise.center.longitude = -7.986295;
    Clonmacnoise.span.longitudeDelta = 4.02f;
    Clonmacnoise.span.latitudeDelta = 4.02f;
    [mapView setRegion:Clonmacnoise animated:YES];

    Annotation *ann2 = [[Annotation alloc] init];
    ann2.title = @Clonmacnoise;
    ann2.subtitle = @546 AD Monastery;
    ann2.coordinate = Clonmacnoise.center;
    [mapView addAnnotation:ann2];


    //Cloon & Laghtanabba Bog
    MKCoordinateRegion CloonLaghtanabbaBog = { {0.0, 0.0} , {0.0, 0.0} };
    CloonLaghtanabbaBog.center.latitude = 53.537161;
    CloonLaghtanabbaBog.center.longitude = -10.081596;
    CloonLaghtanabbaBog.span.longitudeDelta = 4.02f;
    CloonLaghtanabbaBog.span.latitudeDelta = 4.02f;
    [mapView setRegion:CloonLaghtanabbaBog animated:YES];

    Annotation *ann3 = [[Annotation alloc] init];
    ann3.title = @Cloon & Laghtanabba Bog;
    ann3.subtitle = @National Parks;
    ann3.coordinate = CloonLaghtanabbaBog.center;
    [mapView addAnnotation:ann3];



    }

    -(MKAnnotationView *) mapView:(MKMapView *)mapView viewForAnnotation:(id<MKAnnotation>)annotation {
    MKPinAnnotationView *MyPin=[[MKPinAnnotationView alloc] initWithAnnotation:annotation
    reuseIdentifier:@current];
    MyPin.pinColor = MKPinAnnotationColorGreen;

    UIButton *advertButton = [UIButton buttonWithType:UIButtonTypeDetailDisclosure];
    [advertButton addTarget:self action:@selector(button: )


    forControlEvents:UIControlEventTouchUpInside];

    MyPin.rightCalloutAccessoryView = advertButton;
    MyPin.draggable = NO;
    MyPin.highlighted = YES;
    MyPin.animatesDrop=TRUE;
    MyPin.canShowCallout = YES;


    return MyPin;
    }

    -(void)button:(id)sender {

    NSLog(@Button);



    }

    - (void)dealloc
    {
    [super dealloc];
    }

    - (void)didReceiveMemoryWarning
    {
    // If no super view
    [super didReceiveMemoryWarning];

    // Release unused cached images or data.
    }

    #pragma mark - View lifecycle

    /*
    // Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
    - (void)viewDidLoad
    {
    [super viewDidLoad];
    }
    */

    - (void)viewDidUnload
    {
    [super viewDidUnload];
    // Release any retained subviews of the main view.
    // e.g. self.myOutlet = nil;
    }

    - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
    {
    // Return YES for supported orientations
    return (interfaceOrientation == UIInterfaceOrientationPortrait);
    }

    @end


Advertisement