2012-03-15 10 views
0

私は、デフォルトスタイルのセルを含むUITableViewを持っています。 Xcode 4 IBでは、セル内のtextLabelの色を変更できません。私はしかし、フォントの顔&のサイズ、セルあたりの行数などを変更することができます。テキストの色ではありません。興味深いことに、私はプログラム的にもそれを行うことはできません。UITableViewCellのテキストの色を変更できません

// Give the table view a cell to display for a single row 
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath 
{ 
    // reuse or create the cell 
    static NSString *cellID = @"MyCustomCellIdentifier"; 
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellID]; 
    if (cell == nil) { 
     cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellID]; 
    } 

    // NOTE: the setting below does not work when set either here or in IB. 
    cell.textLabel.textColor = [UIColor yellowColor]; 

    // set the text for the cell 
    cell.textLabel.text = [appDelegate.sharedData.arrayFaves objectAtIndex:indexPath.row]; 

    return cell; 
} 

答えて

0

reuseIdentifierがIBのものと一致することを確認してください。私のためにうまく動作します。

+0

私はチェックしました - 彼らは同一です。提案していただきありがとうございます。 – Bassman

+0

プロジェクトを解凍して公衆のDropboxフォルダに貼り付けたら、それを見てみましょう。 –

+0

完了。私はあなたにリンクを張っておくべきですか? – Bassman

0

私はANSを探していた、そして、私はここに見つけることができませんでした前に、私は、将来の航海のために..だから瞬間のカップルので これを追加している..

を使用し、この方法

-(void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath 
{ 

     //Your-code-goes-here---sample-> 
     tCell.cellLabel.textColor = [UIColor grayColor]; 

    } 

これが役に立ちます。

関連する問題