SOffer[26229:c07] current Product: (
{
id = 20;
image = "img2.png";
name = "offer 2";
}
)
NSLog で印刷すると上記の結果になる製品がありますが、これらを個別に印刷する必要があります。次のコードはこれを生成します
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cell"];
if (セル == nil) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"cell"];
}
NSString *現在の製品名;
currentProductName = [productKeys objectAtIndex:indexPath.row];
currentProduct = [products objectForKey:[productKeys objectAtIndex:indexPath.row]];
NSLog(@"現在の製品: %@",currentProduct);
//currentProductName = [currentProduct objectForKey:@"image"];
//現在の製品 = [現在の製品];
[[cell textLabel] setText:currentProductName];
セルを返します。
}
currentProduct は NSArray として宣言されていますが、objectForKey で印刷しようとすると、No visible interface for NSArray はセレクター ObjectForKey を宣言します