簡體   English   中英

解析自定義tableview單元格

[英]Parse custom tableview cell

我正在嘗試使用Parse框架為iPad應用程序創建自定義表格視圖單元。 當我在沒有自定義單元格的情況下進行查詢時,它可以正常工作,但是一旦我更改了單元格標識符,我就會停留在加載圖標上。

代碼如下:

     - (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;
 }

這是我的建議(順便提一下,問題尚不清楚)

首先使用indexpath.Row更改您的標識符

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

第二

如果您要更改現有的單元格,那么您將無法進入

if(cell==nil)

因為你的細胞不是零 寫其他條件。

希望能幫助到你。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM