2014-03-03 14 views
1

我有我的應用程序中的自定義單元格的UITableView。當用戶選擇一個單元格時,會顯示一個詳細的視圖控制器。回到tableView時,帶有文本標籤的標籤出現約10秒鐘,然後消失。 我已經在storyBoard中搜索了標籤,但是我找不到它,但最奇怪的是它僅在用戶從詳細視圖控制器返回到tableViewController時纔會出現。顯示在桌面上的奇怪標籤

下面是我所談論的圖像:

enter image description here

如何檢測代碼中的標籤的任何想法是值得歡迎的。

修訂版**

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath 
{ 
    CustomCell *cell =[tableView dequeueReusableCellWithIdentifier:@"Cell"]; 
    if (cell ==nil){ 
     cell = [[CustomCell alloc]initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:@"Cell"]; 
    } 


    cell.nombreEmpresaLabel.text = [[categorias objectAtIndex:indexPath.row] objectForKey:@"nombreEmpresa"]; 


    cell.textLabel.textColor = [UIColor whiteColor]; 

    cell.direccionEmpresaLabel.text= [[categorias objectAtIndex:indexPath.row] objectForKey:@"direccionEmpresa"]; 


    NSMutableString *logo = [[NSMutableString alloc]initWithString:@"http://mujercanariasigloxxi.appgestion.eu/logos/"]; 
    NSString *imageURL = [[categorias objectAtIndex:indexPath.row] objectForKey:@"strImagen"]; 


    cell.meGustaHits.text = [[categorias objectAtIndex:indexPath.row] objectForKey:@"valoracionEmpresa"]; 




    if(imageURL != nil && ![imageURL isEqual:[NSNull null]]) 
    { 
     [logo appendString:imageURL]; 
     NSURL *logoURL = [NSURL URLWithString:logo]; 
     NSData *logoData = [NSData dataWithContentsOfURL:logoURL]; 
     cell.logoImage.image = [UIImage imageWithData:logoData]; 
    } 
    else{ 
     cell.logoImage.image = [UIImage imageNamed:@"icono80"]; 
    } 



    return cell; 
} 

enter image description here

正如你所看到的,只有三個標籤,一個公司名稱,一個是公司的地址和第三顯示的數字。

+0

是您的tableViewController已在故事板定義的原型細胞? – Srikanth

+0

是@Srikanth,它具有在StoryBoard中定義的ProtoType單元格。 – mvasco

+0

我想你是以編程方式加載自定義單元格。嘗試從storyBoard中移除一次ProtoType單元格,並在您的StoryBoard中進行徹底檢查併爲任何UILabels編程。 – Srikanth

回答

2

有時很難在故事板上找到控制權。

在我看來,你不小心加了它。

如果您沒有使用代碼創建它,則應該在故事板的Document outline中看到它。

enter image description here

+0

謝謝梅達,我不知道我是否偶然添加它,但我現在不知道如何刪除它。請看看我剛纔在場景中添加截圖的最新問題,以放棄「神奇」標籤在那裏。謝謝。 – mvasco

+0

@mvasco如此神奇的標籤不存在吧? – meda

+0

不,它不在那裏,我也在故事板上搜索過源代碼,我找到了自定義單元格中的三個標籤,但沒有找到神奇的標籤......我應該繼續搜索的任何建議? – mvasco

1

你看到「標籤」文本總是處於相同的位置嗎?還是取決於你按下的單元格? ...。我會建議在故事板/ xib上通過控制檯進行搜索。 請去你的項目目錄控制檯,並使用下面的命令來檢查,如果一些用戶界面元素具有文字標籤:

find . -name "*.storyboard" -exec grep "Label" {} \; -print 

如果你也有xibs文件「*的.xib」

執行相同的命令
+0

謝謝芭芭拉,它總是出現在相同的位置。 – mvasco

+0

芭芭拉,您的搜索命令會拋出:./Downloads/Vive Gran Canaria 0-1-8/Vive Gran Canaria/Base.lproj/Main_iPhone.storyboard mvasco

+0

你能幫助我嗎? – mvasco