0

私はuitableviewでプッシュ通知を表示するためのアプリを開発しています。ユーザーによって通知がまだ表示されていない場合は、その通知を印刷するセルの背景色が灰色になります。 だから、ビューは通知がグレーにセルの背景を変更すると通知が、私は背景の色を変更したいセルの選択時にuitableviewcellの背景色を編集するには

if([shown isEqualToString:@"no"]){ 
    cell.contentView.backgroundColor = [UIColor lightGrayColor]; 
    cell.textLabel.backgroundColor = [UIColor lightGrayColor]; 
    cell.detailTextLabel.backgroundColor = [UIColor lightGrayColor]; 
} 
cell.textLabel.text = [NSString stringWithFormat:@"Notifica del %@",data]; 
cell.detailTextLabel.text = message; 

を示している場合、それはデフォルトで残して示されていない場合、私は見

cellForRowAtIndexPath 

方法にロードされていますユーザーがセル

をクリックしたときに白(私は負荷の背景色を触れないでください同じスタイル)私はこれを行う:

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { 
NSString *not = [notification objectAtIndex:indexPath.row]; 
NSArray *stringArray = [not componentsSeparatedByString:@"---"]; 
NSString *message = [stringArray objectAtIndex:0]; 
NSString *data = [stringArray objectAtIndex:1]; 
NSString *shown = [stringArray objectAtIndex:2]; 
UITableViewCell *cell = (UITableViewCell *)[tableView cellForRowAtIndexPath:indexPath]; 
cell.contentView.backgroundColor = [UIColor whiteColor]; 
cell.textLabel.backgroundColor = [UIColor whiteColor]; 
cell.detailTextLabel.backgroundColor = [UIColor whiteColor]; 
UIAlertView *popUp = [[UIAlertView alloc] initWithTitle:[NSString stringWithFormat:@"Notifica del %@",data] message:message delegate:self cancelButtonTitle:@"Ok" otherButtonTitles:nil]; 
[popUp show]; 
[popUp release]; 
} 

結果はすべてのセルが完全に白く(テキストが隠れて)、警告が表示されますが、別のセルをクリックすると、最初のクリックは前と同じようになり、新しいセルのクリックは完全に白くなります。 ?手伝って頂けますか?

答えて

0

UIViewに設定してください。UIViewをcell.takeに追加してください。このUILabelcellというテキストを書き込んでください。今度は、UIView backgroundColorcell.seletionStyle = noneとUILabel backgroundColor =クリアに設定してください。今

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { 

change your view background color and uilabel color. shortly change color of cellview and cell text color 

} 

では、それが唯一の提案ですが、それはあなたを助けるかもしれません。

関連する問題