Light gray background in quot;bounce areaquot; of a UITableView(“反弹区域中的浅灰色背景;一个 UITableView)
问题描述
Apple 的 iPhone 应用程序(例如 Music 和 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).
(请注意,搜索栏的顶部有一条稍暗的边缘线.默认的 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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:“反弹区域"中的浅灰色背景;一个 UITableView
基础教程推荐
- 如何从 logcat 中删除旧数据? 2022-01-01
- libGDX 从精灵或纹理中获取像素颜色 2022-01-01
- iPhone - 获取给定地点/时区的当前日期和时间并将其与同一地点的另一个日期/时间进行比较的正确方法 2022-01-01
- iOS4 创建后台定时器 2022-01-01
- 通过重定向链接在 Google Play 中打开应用 2022-01-01
- AdMob 广告未在模拟器中显示 2022-01-01
- NSString intValue 不能用于检索电话号码 2022-01-01
- navigator.geolocation.getCurrentPosition 在 Android 浏览器上 2022-01-01
- Cocos2d iPhone 非矩形精灵触摸检测 2022-01-01
- Android:getLastKnownLocation(LocationManager.NETWORK_PROVIDER 2022-01-01
