Note that there are some explanatory texts on larger screens.

plurals
  1. POSetting of NSString does'nt work
    primarykey
    data
    text
    <p>Hey all, Here's a funny one. I have two ViewControllers: first one (fires on app load) - > displays a textField and a button. When button is pressed, the text in the textField is to be passed on to the second ViewController through the action method of the button. the second ViewController is to display the text in a Label. The string remains null :-( The label does not change :-(</p> <p>Other thing i did - inside the action method of the first ViewController - I created a new UILabel (you can't see it here...), set its text field to the input i received from the user, then i set the second ViewController's Label to be that one. The label still did not change, but at least the text field of the new label did change. If anyone could explain this to me as well, a=i'll be happy to learn another new thing...</p> <p>first controller code:</p> <pre><code>#import "FlipsideViewController.h" @interface MainViewController : UIViewController &lt;FlipsideViewControllerDelegate&gt; { UITextField *theTextInput; } @property (nonatomic, retain) IBOutlet UITextField *theTextInput; - (IBAction)textFieldDoneEditing:(id)sender; - (IBAction)showInfo:(id)sender; @end </code></pre> <p>the .m relevant part ("FlipsideViewController" is the secondViewController i mentioned):</p> <pre><code>- (IBAction)showInfo:(id)sender { FlipsideViewController *controller = [[FlipsideViewController alloc] initWithNibName:@"FlipsideView" bundle:nil]; controller.delegate = self; controller.textToTransmit.text = self.theTextInput.text; controller.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal; [self presentModalViewController:controller animated:YES]; [controller release]; } </code></pre> <p>and this is the second ViewController:</p> <pre><code>#import &lt;UIKit/UIKit.h&gt; @protocol FlipsideViewControllerDelegate; @interface FlipsideViewController : UIViewController { UILabel *textToTransmit; id &lt;FlipsideViewControllerDelegate&gt; delegate; } @property (nonatomic, assign) id &lt;FlipsideViewControllerDelegate&gt; delegate; @property (nonatomic, retain) IBOutlet UILabel *textToTransmit; - (IBAction)done:(id)sender; -(void)updateLabel:(NSString *)str; @end @protocol FlipsideViewControllerDelegate - (void)flipsideViewControllerDidFinish:(FlipsideViewController *)controller; @end </code></pre> <p>and it's .m file:</p> <pre><code>#import "FlipsideViewController.h" @implementation FlipsideViewController @synthesize textToTransmit; @synthesize delegate; - (void)viewDidLoad { [super viewDidLoad]; self.view.backgroundColor = [UIColor viewFlipsideBackgroundColor]; } - (IBAction)done:(id)sender { [self.delegate flipsideViewControllerDidFinish:self]; } .... </code></pre> <p>Any of you who had the patience to read through my Q - I will be gratefull for an answer that will help me move forward.</p> <p>regards, Joe </p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload