2013-11-15 82 views
0

我有一個隱藏的標籤,只有當我通過didSelectRow單擊單元格時出現一個TableView。在TableView上顯示標籤。滾動時消失TableView

到目前爲止,當我選擇單元格時,會顯示橙色標籤(如圖所示),但當tableView滾動標籤時會出現問題橙色消失,並且僅在更改頁...

橙色標籤指示好友請求是否正在等待,並且引用另一個頁面中存在的查詢,這要歸功於用prepareforsegue報告的可變數組。

你能解釋爲什麼橙色標籤消失嗎?當我選擇單元格時,如何讓它停留在TableView上? 標籤橙色是「RichiestaInAttesaLabel」 P.我使用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 { 

enter image description here

+0

如果完成if(!isFiltered){? – Ilario

+0

檢查我的編輯代碼 – kAiN

回答

-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」,在這兩種情況下?

+0

因爲自isFriend:用戶意識到,如果他們是朋友還是不 自我Is_InAttesa:用戶識別如果請求未完成或者未 – kAiN

+0

你爲什麼不設置「[cell.RichiestaInAttesaLabel setHidden:YES];」一次在開始,並將其更改爲「否」在「if([self Is_InAttesa:user]){...」? – Alex

+0

我試圖做到這一點,但當我滾動TableView的橙色標籤消失 – kAiN