如何为分组表视图设置背景图像? [英] How do I set a background image for a grouped table view?

查看:18
本文介绍了如何为分组表视图设置背景图像?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我见过一些 iPhone 应用程序使用自定义图像作为分组 UITableView 的背景,而不是标准的灰线.

I've seen some iPhone applications that use a custom image as the background for a grouped UITableView, instead of the standard gray lines.

这是如何实现的?

推荐答案

在另一个项目(使用 2.2.1 开发)中,我通过将 UITableView' 的背景不透明度设置为 0% 来做到这一点,并且然后使用 Interface Builder 在其后面简单地分层 UIImageView.无论表格状态如何,这让我有一个固定的背景.您也可以将 UITableView 的背景设置为图像,但随后背景会随表格滚动.(目前我手头没有代码,但不久前我在 Apple 开发者论坛上得到了提示).

In another project (developed using 2.2.1) I did this by setting my UITableView's background opacity to 0%, and then simply layering a UIImageView behind it using Interface Builder. This allowed me to have a fixed background regardless of the table state. You can also set the background of the UITableView to be an image instead, but then the background scrolls with the table. (I don't have the code handy at the moment, but I got the tip a while back on the Apple developer forums).

请注意,这可能会导致一些性能问题.Apple 不鼓励尽可能使用透明度,因为 3GS 之前的型号上的 GPU 并不是特别强大.

Note that this can cause some performance issues. Apple discourages using transparency whenever possible because the GPUs on the pre-3GS models aren't particularly beefy.

这篇关于如何为分组表视图设置背景图像?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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