I need to pass the text o开发者_StackOverflow中文版f a UITextView in viewController1 to viewController2 and set the text to a string in viewController2. I thought I had the code figured out, but it turns out that nothing is being passed. In viewController2.h I added viewController1*v1 and assigned a property to it. in the viewController2.m
-(void)method{
v1=[[viewController1 alloc] initWithNibName:@"viewController1" bundle:nil];
NSString *text=[[NSString alloc]init];
[v1.tweetText setText:text];
}
This is probably the wrong way to go about it, so does anyone have other solutions to this problem?
Thats the correct way to send data to another vc, but you are not setting the variable text
to anything. Try setting it to hello
and see if you get hello
as the tweetText in the other vc.
精彩评论