我不會通過它發送信息。
在didSelectRowAtIndexPath
做你[self performSegueWithIdentifire:@"blah"]
然後在prepareForSegue
做這樣的事情......
- (void)prepareForSegue:... //blah cant remember the name
{
if ([segue.identifier isEqualToString:@"blah"]) {
NewViewController *controller = segue.destinationViewController;
NSIndexPath *selectedIndexPath = [self.tableView indexPathForSelectedRow];
//get the object associated with that row and set a variable like...
NSString *selectedString = tableObject.name;
//Then pass the string into the controller...
controller.stringProperty = selectedString;
}
}
然後在NewViewController.h
成立了@property
接受這個...
@property (nonatomic, strong) NSString *stringProperty;
然後你可以從NewViewCongtroller.m
訪問此值,並將其值傳遞給它。
這可能會幫助你:http://iphonedevsdk.com/forum/iphone-sdk-development/54859-sharing-data-between-view-controllers-and-other-objects-link-fixed.html –