更新
DetailViewController *wordDetail = [[DetailViewController alloc] initWithNibName:@"DetailViewController" bundle:nil];
wordDetail.wordWordString = [[NSString alloc] initWithString:[[myArray objectAtIndex:indexPath.row] objectForKey:@"word"]];
wordDetail.wordDefinitionString = [[NSString alloc] initWithString:[[myArray objectAtIndex:indexPath.row] objectForKey:@"definition"]];
wordDetail.title = [[myArray objectAtIndex:indexPath.row] objectForKey:@"name"];
[self performSegueWithIdentifier:@"showDetail" sender:self];
这是我为 segue 做的新准备(你的意思是如果我使用上述方法,我就不再需要它了,还是根本不需要?我现在确定我的所有标识符是否都在排队......你觉得呢?
-(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
if ([[showDetail] isEqualToString:@"showDetail"]) {
NSIndexPath *indexPath = [self.tableView indexPathForSelectedRow];
NSDate *object = _objects[indexPath.row];
[[segue destinationViewController] setDetailItem:object];
图它也可能有助于查看我的 DetailViewController.m ......
-(void)setDetailItem:(id)newDetailItem
{
if (_detailItem != newDetailItem) {
_detailItem = newDetailItem;
// Update the view.
[self configureView];
}
if (self.masterPopoverController != nil) {
[self.masterPopoverController dismissPopoverAnimated:YES];
}
}
-(void)configureView
{
//Update the user interface for the detail item.
if (self.detailItem) {
self.detailDescriptionLabel.text = [self.detailItem description];
}
}
- (void)viewDidLoad
{
wordWordLabel.text = wordWordString;
wordDefinitionLabel.text = wordDefinitionString;
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
[self configureView];
}