开发者

Making UITableViewCells bleed over

What I'm trying to achieve might be a bit of a novelty, but maybe someone has already done this or has some great ideas. Here's the situation: I have a UITableView sitting on top of a UIImageView (which provides the background) that has a brushed metal texture. The fist row in the table is colored black. What I'd like to achieve, is the following: when the user tries to scroll up (by pulling down) from the top of the tableview and thus causes the "bounce" physics to kick in I'd like to have the space at the top of the table view be black to seamlessly blend rather than have the user see the background image.

I can't just add another black subview under the the table because then if the tables contents is just one row it'd show under the first cell as well, considering bounce scroll lets the user scroll halfway down the screen.

I've tried setting the cells background view to a black view with a rect like 0, -100, 320开发者_如何转开发, 142 (where the cell itself should be 42px high) and setting clipsToBounds to NO on both the backgroundView and the cell itself, but no dice.

Any ideas?


Set UITableView.tableHeaderView to a suitable view. Headers/footers are useful in general (you can have shadows at the end like UIWebView, or a background that moves with the cells, or whatever).

Make sure you handle the zero-cells case sensibly (although the problem isn't visible if scrolling's disabled when there aren't enough cells to require it, or if there can't be zero cells).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜