我正在尝试在标签栏应用程序中开发一个带有情节提要的 RSS 阅读器钻取表。我已经设法用解析的 XML 填充我的 RootTableViewController。我现在在解决如何让我的 RootTableViewController 中的每一行指向并将数据从所选单元格传递到另一个 DetailTableViewController 时遇到问题。
这是我解析 XML 并填充 RootTableViewController 的代码的一部分:
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return [stories count];
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"AdvCurrentCelly";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
}
int storyIndex = [indexPath indexAtPosition: [indexPath length] - 1];
NSString *description = [[stories objectAtIndex: storyIndex] objectForKey: @"description"];
NSString *title = [[stories objectAtIndex: storyIndex] objectForKey: @"title"];
//This populates the prototype cell 'AdvCurrentCelly'
cell.textLabel.text = title;
//cell.textLabel.text = date;
cell.detailTextLabel.text = description
return cell;
}
在 Storyboard 中,从 RootTableViewContoller 单元格到 DetailTableViewController 的 segue 名称是ShowADVDetail
非常感谢帮助
简