I am trying to pass an NSString
(message
) from ViewController
(sender) to MyViewController
(receiver).
I created an instance of MyViewController
in ViewController
called testViewContoller
, through which I am sending the NSString
using the setTitle:
method:
MyViewController *testViewController = [[MyViewController alloc] init];
[testViewController setTitle:message];
Here's MyViewController.h
:
- (void)setTitle:(NSString*)title;
Here's MyViewController.m
:
- (void)setTitle:(NSString*)title {
_testField.text = title;
}
I am not completely sure as to why this isn't working, but I think it has to do with viewDidLoad
loading before setTitle:
is called.
Any help you can provide would be greatly appreciated.
Thank you.