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 in the diagram, when I click on the label in front of location ( in First view controller ) a modal segue opens a second view controller containing map.
2.In the map view controllers, when the user moves the map with touch, I'm getting address value in a label. ( similar to uber app )
3.After this , as soon as user presses done button on this controller, it gets back to the first view controller using custom segue and with the value of the location.
The problem is that, iboulet of this label is hidden in the UI and doesn’t display its value. But when I print this value in console, I am able to display the value.
Below is my code. Help is much appreciated.
First View Controller code written in swift:
- (void)viewDidLoad {
[super viewDidLoad];
_Locationlabel.text=_location;
NSLog(@"location=%@",_Locationlabel.text);
}
Second View Controller code:
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject!) {
if (segue.identifier == "locationDone") {
// pass data to next view
var svc = segue.destinationViewController as Host;
svc.location = self.addressLabel.text;
println("location\(svc.location)");
}
}
@IBAction func doTap(x:UIButton) {
self.dismissViewControllerAnimated(true, completion: {});//This is intended to dismiss the Info sceen.
println("pressed")
}