私の質問のように、私はちょうど彼/彼女のtableviewとtableviewcellの背景を使用するアプリケーションを作った人に尋ねたい。私はそれらの背景に問題があります。ここに私のアプリのPICは、私がtableviewcellに背景用テーブルビューとwhitecolorに背景にgraycolorを使用し、問題 tableviewとtableviewcellのバックグラウンドを使ってアプリケーションを作った人は誰ですか?
であり、私は、テキストがwhitecolorバックグラウンドを持っているcontaintすべてのセルを作りたいが、私はそれを行うことはできません。 ここに私のコードは
-(void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath{
UIView* backgroundView = [ [ [ UIView alloc ] initWithFrame:CGRectZero ] autorelease ];
//--new color code--
backgroundView.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"celltable_root.png"]];
cell.backgroundView = backgroundView;
for (UIView* view in cell.contentView.subviews)
{
if(_segmentedControl.selectedSegmentIndex == 0){
FileModel *filemodels = [_filemodels objectAtIndex:indexPath.row];
if([filemodels.fileExpanse compare:@"display"]==0){
backgroundView.backgroundColor = [UIColor whiteColor];
}else{
backgroundView.backgroundColor = [UIColor whiteColor];
}
}
view.backgroundColor = [ UIColor clearColor]; //set cell background
}
[[self tableView] setBackgroundColor:[UIColor grayColor]];
}
私のコードで何かが間違っているのです?
あなたは、 "私はすべてのセルに白黒の背景があるようにしたい"と書いています。テーブルに表示したいお願いしてください。その後、私は助けるかもしれません。 – Developer
hhmmm ...多分そのテーブルの10行、テキストは配列 –
からいっぱいです。そして、urは "noOfRowsInSection"で書かなければなりません。return [yourArray count];私はあなたの質問を明確に得ていないので、私はそれを更新するurコードのリンクを提供してください。もう一つのこと:それはどういう意味ですか? if([filemodels.fileExpanse compare:@ "display"] == 0){ backgroundView.backgroundColor = [UIColor whiteColor]; }他{ backgroundView.backgroundColor = [UIColor whiteColor]。 }どちらの場合も の出力は同じです。 – Developer