使用搜索栏时的UITableview背景颜色 [英] UITableview background color when using Search Bar

查看:54
本文介绍了使用搜索栏时的UITableview背景颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在UITableview中使用了搜索栏.当我输入搜索文字时,背景颜色将自动更改为白色.

I used searchbar with my UITableview. When I enter search text, the background color will be changed automatically as white color.

我也使用过:

tableView.bounces=FALSE;

当我使用搜索栏时,那段时间也会反弹,不会起作用.

When I used searchbar, that time bounces also, won't work.

输出如下:

  1. 搜索内容时,我需要更改背景颜色.

  1. I need to change background color, when I searching content.

我需要:

tableView.bounces = FALSE;

tableView.bounces=FALSE;

当我搜索内容时,

将起作用.

will work, when I searching content.

推荐答案

回答我的问题:

  -(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;
}

这篇关于使用搜索栏时的UITableview背景颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆