“反弹区域”中的浅灰色背景。一个UITableView [英] Light gray background in "bounce area" of a UITableView

查看:125
本文介绍了“反弹区域”中的浅灰色背景。一个UITableView的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Apple的iPhone应用程序(如Music and Contants)使用UITableView中的搜索栏。向下滚动以使搜索栏向下移动时,滚动视图内容上方的空白区域呈浅灰色背景颜色(参见屏幕截图)。

Apple's iPhone apps such as Music and Contants use a search bar in a UITableView. When you scroll down so that the search bar moves down, the empty space above the scroll view's contents has a light gray background color (see screenshot).

(请注意搜索bar的顶部有一条稍暗的边缘线。这不适用于默认的UISearchBar,但是子类化应该处理它。)

(Notice that the search bar has a slightly darker edge line at its top. This is not there for the default UISearchBar, but subclassing should take care of that.)

我尝试设置背景颜色UITableView,但也会影响行。有谁知道如何实现这种效果?我是否必须覆盖实现drawRect:或者是否有内置方式?

I tried setting the background color of the UITableView, but that affects the rows as well. Does anyone know how to achieve this effect? Am I going to have to override implement drawRect: or is there a built in way?

推荐答案

从iOS 7开始,你可以通过更改tableview背景视图来修改它。

As of iOS 7, you can tinker this by changing the tableview background view.

[self.tableView setBackgroundView:view];

使视图的背景颜色与父视图颜色相同。

make the view's background colour the same as your parent view colour.

这篇关于“反弹区域”中的浅灰色背景。一个UITableView的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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