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


- Android - 我如何找出用户有多少未读电子邮件? 2022-01-01
- 使用自定义动画时在 iOS9 上忽略 edgesForExtendedLayout 2022-01-01
- 在测试浓缩咖啡时,Android设备不会在屏幕上启动活动 2022-01-01
- android 4中的android RadioButton问题 2022-01-01
- MalformedJsonException:在第1行第1列路径中使用JsonReader.setLenient(True)接受格式错误的JSON 2022-01-01
- 如何检查发送到 Android 应用程序的 Firebase 消息的传递状态? 2022-01-01
- Android viewpager检测滑动超出范围 2022-01-01
- Android - 拆分 Drawable 2022-01-01
- 想使用ViewPager,无法识别android.support.*? 2022-01-01
- 用 Swift 实现 UITextFieldDelegate 2022-01-01