小编MIr*_*fan的帖子

计算字典对象中值的数量

<pre>
    products =     (
                {
            id = 19;
            "image_url" = "http://localhost:8888/straightoffer/image/data/1330374078photography.jpg";
            name = "Save $240 on your next photo session";
        },
                {
            id = 21;
            "image_url" = "http://localhost:8888/straightoffer/image/data/1330373696massage.jpg";
            name = "One Hour  Massage";
        }
    );
}
</pre>
Run Code Online (Sandbox Code Playgroud)

以上是我通过json得到的,我需要将值分配给uitableviews:

    - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
        NSLog(@"行数:%d",[[products objectForKey:@"products"] count]);
        return [[products objectForKey:@"products"] count];
    }
    - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
        UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cell"];
        如果(单元格 == 零){
            单元格 = [[UITableViewCell 分配]
                initWithStyle:UITableViewCellStyleDefault
                重用标识符:@"单元格"];
        }
        NSString *currentProductName;
        currentProductName = [productKeys objectAtIndex:indexPath.row];
        NSLog(@"产品名称:%@", currentProductName);
        [[cell …

uitableview ios

4
推荐指数
1
解决办法
369
查看次数

标签 统计

ios ×1

uitableview ×1