我正在从我的 API 中解析一堆字符串。其中之一是产品 ID。我想使用此 ID 来确定选择了哪个产品,以便我可以在详细视图控制器中解析更多详细信息。
我现在遇到的问题是我在表格视图中正确解析了 ID(它在日志中正确显示)但是当我将它推送到详细视图控制器时,我(null)
从那里的日志中得到响应。我不明白这一点。
在我的表格视图中:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *neuheitenCell = @"neuheitenCell";
CJHomeTableCell *cell = [tableView dequeueReusableCellWithIdentifier:neuheitenCell];
wareID = [[arrayArtikelWareID objectAtIndex:indexPath.row] objectForKey:@"ware_id"];
//NSLog(@"Selected item with id: %@",sstring);
return cell;
}
-(NSIndexPath *)tableView:(UITableView *)tableView willSelectRowAtIndexPath:(NSIndexPath *)indexPath {
CJArtikelDetailViewController *artikelView = [[CJArtikelDetailViewController alloc] init];
NSString *test = [NSString stringWithFormat:@"%@", wareID];
NSLog(@"Test1: %@", wareID);
artikelView.wareID = test;
//NSLog(@"URL1: %@",test);
return indexPath;
}
提前致谢