我有一个隐藏标签的TableView,只有当我通过didSelectRow点击单元格时才会出现。
到目前为止一切都很好,当我选择单元格时,会显示橙色标签(如图所示),但是当tableView滚动标签时会出现问题橙色消失并且只有在我更改页面时才会返回...
橙色标签表示朋友请求是否未决,并且由于使用prepareforsegue报告了一个可变数组,因此引用了另一个页面中存在的查询。
你能解释为什么橙色标签会消失吗?当我选择单元格时如何使其保持在TableView上? 标签橙色是“RichiestaInAttesaLabel” 附:我正在使用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 {
答案 0 :(得分:-1)
if ([self isFriend:user]) {
[cell.TapAggiungiLabel setHidden:YES];
[cell.RichiestaInAttesaLabel setHidden:YES];
}
else {
[cell.TapAggiungiLabel setHidden:NO];
[cell.RichiestaInAttesaLabel setHidden:YES ];
}
为什么“cell.RichiestaInAttesaLabel setHidden:YES”在这两种情况下?