2010-12-07 8 views
6

私は自分のUITableviewで検索バーを使用しました。検索テキストを入力すると、背景色が自動的に白色に変更されます。UITableview検索バーを使用するときの背景色

とも私が使用:

tableView.bounces=FALSE; 

私は検索バーを使用する場合、その時は動作しません、また弾みます。

次のようにのような出力:

alt text

  1. 私は、コンテンツを検索するときに、背景色を変更する必要があります。

  2. は私が必要:

    tableView.bouncesを= FALSE;

コンテンツを検索するときに機能します。

答えて

16

回答:

-(BOOL)searchDisplayController:(UISearchDisplayController *)controller shouldReloadTableForSearchString:(NSString *)searchString 
{ 
UIImage *patternImage = [UIImage imageNamed:@"1.png"]; 
[controller.searchResultsTableView setBackgroundColor:[UIColor colorWithPatternImage: patternImage]]; 
controller.searchResultsTableView.bounces=FALSE; 
return YES; 
} 
0

セルの背景色をクリアカラーに設定し、検索時にテーブルをリロードしているときにその(テーブル)背景色を黒に設定します。私の質問のための

+0

私は、次の\t \t tableView.backgroundColor = [UIColor clearColor]を使用。 \t \t tableView.opaque = NO; \t \t tableView.backgroundView = nil; しかし、それは私があなたの細胞の背景色を明らかにしていないと言っていることは – Velmurugan

+0

thats働いていない。私はそれもdoesntの仕事\t \t [細胞contentView] setBackgroundColor:[UIColor clearColor] .....また、以下を使用cellforrowatindex –

+0

でclearcolorようにセルの背景色を設定するので、第一、 \t \t [セルの背景ビュー] setBackgroundColor:[UIColor clearColor]]; \t \t [cell setBackgroundColor:[UIColor clearColor]]; – Velmurugan

関連する問題