我有一个带有隐藏标签的 TableView,只有当我通过 didSelectRow 单击单元格时才会出现。
到目前为止一切顺利,当我选择单元格时,会显示橙色标签(如您从图像中看到的那样),但是当 tableView 滚动时出现问题,标签橙色消失并且只有在我更改页面时才会返回......
橙色标签指示好友请求是否处于待处理状态,并通过 prepareforsegue 报告的可变数组来引用另一个页面中存在的查询。
你能解释为什么橙色标签消失了吗?当我选择单元格时,如何让它留在 TableView 上?橙色标签是“RichiestaInAttesaLabel” Ps 我正在使用 Parse.com
-(UITableViewCell * )tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"Cell";
FFCustomCellUtentiGenerali *cell =[self.TableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[FFCustomCellUtentiGenerali alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier];
}
if (!isFiltered) {
PFObject *object = [self.Utenti objectAtIndex:indexPath.row];
NSString *str = [object objectForKey:FF_USER_NOMECOGNOME];
cell.NomeCognome.text = str;
cell.FFFotoProfilo.file = [object objectForKey:FF_USER_FOTOPROFILO];
cell.FFFotoProfilo.image = [UIImage imageNamed:@"FFNoFotoUSer"];
[cell.FFFotoProfilo.layer setMasksToBounds:YES];
[cell.FFFotoProfilo.layer setCornerRadius:30.0f];
cell.FFFotoProfilo.contentMode = UIViewContentModeScaleAspectFill;
[cell.FFFotoProfilo loadInBackground];
[cell.BackgroundReputazioneBlu.layer setMasksToBounds:YES];
[cell.BackgroundReputazioneBlu.layer setCornerRadius:15.0f];
[cell.BackGroundReputazione.layer setMasksToBounds:YES];
[cell.BackGroundReputazione.layer setCornerRadius:17.0f];
[cell.TapAggiungiLabel.layer setMasksToBounds:YES];
[cell.TapAggiungiLabel.layer setCornerRadius:3.0f];
[cell.RichiestaInAttesaLabel.layer setMasksToBounds:YES];
[cell.RichiestaInAttesaLabel.layer setCornerRadius:3.0f];
PFUser *user = [self.Utenti objectAtIndex:indexPath.row];
[cell.TapAggiungiLabel setHidden:YES];
[cell.RichiestaInAttesaLabel setHidden:NO];
if ([self isFriend:user]) {
[cell.TapAggiungiLabel setHidden:YES];
[cell.RichiestaInAttesaLabel setHidden:YES];
}
else {
[cell.TapAggiungiLabel setHidden:NO];
[cell.RichiestaInAttesaLabel setHidden:YES ];
}
if ([self Is_InAttesa:user]) {
[cell.RichiestaInAttesaLabel setHidden:NO];
[cell.TapAggiungiLabel setHidden:YES];
}
else {
[cell.RichiestaInAttesaLabel setHidden:YES];
}
}
//end IsFiltred
else {