简体   繁体   English

解析自定义tableview单元格

[英]Parse custom tableview cell

I am trying to make a custom tableview cell for an iPad app, using the Parse framework. 我正在尝试使用Parse框架为iPad应用程序创建自定义表格视图单元。 When i query without the custom cell, it works fine, but as soon as i am changing the cell identifier, i am just stuck at the loading icon. 当我在没有自定义单元格的情况下进行查询时,它可以正常工作,但是一旦我更改了单元格标识符,我就会停留在加载图标上。

The code goes as follows: 代码如下:

     - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath object:(PFObject *)object {
 static NSString *CellIdentifier = @"specielCelle";

 sagerCelle *cell = (sagerCelle *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];
 if (cell == nil) {
 cell = [[sagerCelle alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
 }

 // Configure the cell
     cell.lblPolice.text = [object objectForKey:@"police"];
 //cell.textLabel.text = [object objectForKey:self.textKey];
 //cell.imageView.file = [object objectForKey:self.imageKey];

 return cell;
 }

Here my advices,(By the way the question is not clear) 这是我的建议(顺便提一下,问题尚不清楚)

Firstly change your identifier with an indexpath.Row 首先使用indexpath.Row更改您的标识符

    NSString *cellIdentifier=[NSString stringWithFormat:@"CELL_%d",(int)indexPath.row];

Second 第二

if you are changing your existing cell then you are not be able to go inside of the block of 如果您要更改现有的单元格,那么您将无法进入

if(cell==nil)

because your cell is not nil. 因为你的细胞不是零 Write else condition. 写其他条件。

Hope it helps. 希望能帮助到你。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM