gpt4 book ai didi

uitableview - parse.com 中多节 tableView 中的 cellForRowAtIndexPath 问题

转载 作者:行者123 更新时间:2023-11-30 10:21:36 27 4
gpt4 key购买 nike

我在 Parse.com 的 tableView 中使用 cellForRowAtIndexPath 时遇到问题我正在运行的代码是:

override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCellWithIdentifier("ListadoInventarioCell", forIndexPath: indexPath) as UITableViewCell

var sectionTitle:String = timelineData1.objectAtIndex(indexPath.section) as String
var sectionAnimals:Array = porBodega[sectionTitle]!

// This is the line with problems
var animal:String = sectionAnimals.objectAtIndex(indexPath.row) as String
cell.textLabel?.text = animal
}

问题是变量 porBodega 是 String: ArrayOfPFObject 类型的字典,因此sectionAnimals 是 PFObjects 的数组。如果我执行 println(porBodega),我会得到:

[Oficina: [
<InventarioObjetos:wObhxQ98oz:(null)> {
Bodega = Oficina;
Categoria = "Equipo de monta\U00f1a";
Descripcion = Chalecos;
FechaDeEntrada = "2012-04-01 19:44:00 +0000";
Marca = "O'rageous";
Modelo = "VM-001";
NumeroDeInventario = CSOV002;
NumeroDeSerie = NA;
Status = Usado;
Tamano = M;
},
<InventarioObjetos:u3Yn80lXU8:(null)> {
Bodega = Oficina;
Categoria = "Equipo de monta\U00f1a";
Descripcion = Chalecos;
FechaDeEntrada = "2012-04-01 19:44:00 +0000";
Marca = "O'rageous";
Modelo = "VM-001";
NumeroDeInventario = CSOV003;
NumeroDeSerie = NA;
Status = Usado;
Tamano = M;
}
]]

所以我不知道如何从我的对象之一获取特定数据,例如变量 Modelo,然后将其设置在单元格文本标签中。有什么想法吗??

最佳答案

编辑:

override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCellWithIdentifier("ListadoInventarioCell", forIndexPath: indexPath) as UITableViewCell

var sectionTitle:String = timelineData1.objectAtIndex(indexPath.section) as String
var sectionAnimals:Array = porBodega[sectionTitle]!

let animal:PFObject = sectionAnimals[indexPath.row] as PFObject
cell.textLabel?.text = animal.objectForKey("modelo") as String
}

关于uitableview - parse.com 中多节 tableView 中的 cellForRowAtIndexPath 问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26221009/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com