アップデート
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];
これがセグエの新しい準備です(上記の方法を使用すれば、もう必要ないということですか?またはまったく必要ありませんか?実際、すべての識別子が並んでいるかどうかは確かです...どう思いますか?
-(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];
}