主视图控制器.h
NSString *quality;
主视图控制器.m
#import DetailViewController.h
-(void)viewDidLoad {
quality = [NSString stringWithFormat:@"string to pass"];
...
}
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
if ([[segue identifier] isEqualToString:@"showDetail"]) {
DetailViewController *detailView = [segue destinationViewController];
NSIndexPath *indexPath = [self.tableView indexPathForSelectedRow];
theList = [app.listArray objectAtIndex:indexPath.row];
detailView.theList = theList;
detailView.streamQuality = quality;
}
}
DetailViewController.h
@property (nonatomic ,retain) NSString *streamQuality;
细节视图控制器.m
@synthesize streamQuality;
NSLog(@"Final: %@", streamQuality);
输出:大多数我得到“线程1:EXC_BAD_ACCESS(代码= 2,地址= 0x10)”
或随机的东西,如“最终:复制音频地址”
但是,这很好用:
detailView.streamQuality = @"hello";