How do I call the following method from this IBAction? I want to call the prepareForSegue: method instead of the NSLog(@"clicked");
Here's the IBAction:
- (IBAction) annotationViewClick:(id) sender {
NSLog(@"clicked");
}
Here's the method:
// Do some customisation of our new view when a table item has been selected
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
// Make sure we're referring to the correct segue
if ([[segue identifier] isEqualToString:@"ShowMoreInfo"]) {
// Get reference to the destination view controller
MoreDetailViewController *mdvc = [segue destinationViewController];
[mdvc setSelectedItemName:[NSString stringWithFormat:@"%@", placeName.text]];
[mdvc setSelectedItemAddress:[NSString stringWithFormat:@"%@", placeFormattedAddress.text]];
[mdvc setSelectedItemWeb:[NSString stringWithFormat:@"%@", placeWebsite.text]];
[mdvc setSelectedItemRating:[NSString stringWithFormat:@"%@", placeRating.text]];
// [mdvc setSelectedItemDistance:[NSString stringWithFormat:@"%@", placeDistance.text]];
}
}
thanks for the help!
prepareForSegue:
method calls automatically when you performing a segue.
To perform a segue you should use performSegueWithIdentifier:
,
for ex. [self performSegueWithIdentifier:@"showGuide" sender:self];
,
in this case you need assign identifier to a segue in Xcode Interface Builder.