I am building an iOS app using storyboards.I have implemented google maps in my app using swift and rest of the code is in objective C.
My scenario:
1.As shown
You shouldn't use a custom segue to return to your first view controller. Segues always create a new instance of a view controller (unless you use an unwind segue). In your first view controller, add this method:
- (IBAction)backFromMapView:(UIStoryboardSegue *)segue
{
NSLog(@"and we are back");
MapViewController* mvc = (MapViewController *)segue.sourceViewController;
NSLog(@"location %@", mvc.addressLabel.text);
}
Don't forget to #import
so that Host.m
will know about MapViewController
.
Then you'd control drag from the Done
button in your Map View Controller to the orange exit icon in the bar above the view controller in the Storyboard. In the pop up, you'd select backFromMapView
and voila, you're done.