I'm making an app that behaves something like the default Messages.app in iPhone where a user composes a text message in a UITextField and upon tapping the Send button, the value of the UITextField in ComposeViewController will be transferred to the table cell's UILabel in a custom cell in MasterViewController and also to the DetailViewController where another UILabel will get the text value from the UITextField. The DetailViewController is the ViewController loaded when the user taps the cells from the UITableViewCells.
I actually read related articles below but it doesn't work on my end.
- How to send the text from textfield to another class?
- How to see text from one text field in another text field?
- How to send text field value to another class
Can you please guide me on how to properly implement this? I know it's easy. I just don't know why it's not working. ComposeVC is a ModalViewController while DetailVC is the view that loads when the user taps the cell in the MasterVC's table.
Thanks a lot!
Below is my code for ComposeVC.h:
    UITextField *messageTextField;
    @property (nonatomic, retain) IBOutlet UITextField *messageTextField;
    - (IBAction)buttonPressed:(id)sender;
for ComposeVC.m
    synthesize messageTextField;
    -(IBAction)buttonPressed:(id)sender
    {
        DetailVC *detailVC = [[DetailVC alloc] init];
        detailVC.messageText = messageTextField.text;
    }
for DetailVC.h
    NSString *messageText;
    @property (nonatomic, copy) NSString *messageText;
for DetailVC.m
    @synthesize messageText;
    - (void)viewLoad
    {
        testLabel.text = messageText;
    }
testLabel is the UILabel inside my DetailVC.
 
     
     
     
     
     
    