Reputation: 13
what i have is when you select something is a uipickerview a label is than changed to the contents of the picker view. This works however I'm having trouble with taking the contents of the label in my pickerView.h and send it to set the contents of another label in my pickerDuration.h(secondViewController)
Upvotes: 0
Views: 1185
Reputation: 685
okay try this....
Have a NSString
in ur SecondViewController
and make sure u create a property of it (strong
if u are using IOS 5 ARC) Synthesize it
You must have an object of SecondViewController
for navigation purpose. Use the same object to set the value like this
secondViewObj.myStr = label.text;
make sure u do that before navigating to the next view
EDIT
Okay Try this
After performSegueWithIdentifier:sender: your view controler will call assuming your new view controller has some propertys to set:
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
if ([[segue identifier] isEqualToString:@"NextView"]) {
SecondViewController *myVC = [segue destinationViewController];
myVC.mystr= label.text;
}
Upvotes: 1
Reputation: 15
Create on object of SecondViewController in your currentViewController which has the label. Declare a string in SecondViewController.
Init secondViewController object in your currentViewController and set its NSString to label's text. Something like this
secondViewController.string = label.text;
Upvotes: 0