主视图控制器.m
#import "DetailViewController.h"
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
if ([segue.identifier isEqualToString:@"DetailViewControllerSeque"]) {
DetailViewController *detailView = [segue destinationViewController];
NSIndexPath *indexPath = [self.tableView indexPathForSelectedRow];
theList = [app.listArray objectAtIndex:indexPath.row];
detailView.theList = theList;
// String to pass to DetailViewController
detailView.string2pass = @"this is a passing string";
}
}
DetailViewController.h
NSString *string2pass;
@property (retain, nonatomic) NSString *string2pass;
细节视图控制器.m
NSLog(@"%@", string2pass);
输出:(空)
我做错了什么?