简体   繁体   中英

Parse custom tableview cell

I am trying to make a custom tableview cell for an iPad app, using the Parse framework. 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

    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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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