Light gray background in “bounce area” of a UITableView

前端 未结 16 2106
一整个雨季
一整个雨季 2020-11-28 23:05

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 v

16条回答
  •  佛祖请我去吃肉
    2020-11-28 23:25

    EASIEST SOLUTION

    The easiest way to create different colors in the bottom and in the top of a bouncing area of a table view is to set the key tableHeaderBackgroundColor of the table view. Doing this way you set the top color. I'm not sure, but maybe there is another key for the footer, take a look. If you don't find anything, you just have to set the background of the table view with the color that you want to show in the bottom. Above you can see an example code:

    self.table.setValue(UIColor.blue , forKey: "tableHeaderBackgroundColor")
    

    Hope it help you. If yes, let other people know about this easy way giving an up in the answer :)

提交回复
热议问题