【问题标题】:how can i print values stored in NSMutable Array.. to UITableView cell如何将存储在 NSMutableArray.. 中的值打印到 UITableViewcell
【发布时间】:2010-08-17 05:49:50
【问题描述】:

我有这个 coe....谁能告诉我如何在 UITable 视图单元格上打印它

[customerDetailsArray addObject:[NSDictionary dictionaryWithObjectsAndKeys:nameStr,@"name",cityStr,@"city",countryStr,@"country",nil]]; NSLog(@"customerDetailsArray %@",customerDetailsArray);

我正在尝试这种方式,但没有成功

if(indexPath.row == 0) { cell.textLabel.text = [NSString stringWithFormat:@"",[[customerDetailsArray objectAtIndex:indexPath.row] objectForKey:@"name"]]; }

谢谢你..如果你喜欢我的问题至少接受它......

【问题讨论】:

    标签: objective-c


    【解决方案1】:

    您每次都输入一个空白字符串。改成这样:

    if(indexPath.row == 0) { 
        cell.textLabel.text = [NSString stringWithFormat:@"%@",[[customerDetailsArray objectAtIndex:indexPath.row] objectForKey:@"name"]]; 
    }
    

    注意%@

    【讨论】:

    • 感谢 Matt 的快速回复,但你知道..即使我已经尝试过了..但是 UITable 视图单元格上出现了 NULL 值..但是当我使用 NSLog 打印数组时...它打印正确....等待你的回应马特
    • 您确实将%@ 放入了[NSString stringWithFormat:@"%@" 中?你能过去看看数组是什么样子的吗?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-07-17
    • 1970-01-01
    • 1970-01-01
    • 2017-03-31
    • 2011-02-25
    相关资源
    最近更新 更多