目前我有这段代码将 TableView 中的默认背景更改为自定义图片,但是当用户在 UISearchBar 中进行搜索时,搜索结果 TableView 是纯白色背景。我在哪里/如何将其更改为与我的常规非搜索 TableView 相同?
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
self.title = NSLocalizedString(@"Employee List", @"Employee List");
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad) {
self.clearsSelectionOnViewWillAppear = NO;
self.contentSizeForViewInPopover = CGSizeMake(320.0, 600.0);
}
else {
{
UIImageView *tempImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"Cloth.png"]];
[tempImageView setFrame:self.tableView.frame];
self.tableView.backgroundView = tempImageView;
}
}
}
return self;
}