创建与选定的 UITableViewCell 类似的 UILabel 背景
我想创建一个 UILabel
并将其背景设置为渐变蓝色,就像选定的 UITableViewCell
一样。我怀疑我需要使用 UIColor colorWithPatternImage:
。如果是,我不确定获取图案图像的最佳方法是什么。或者,关于如何实现这一目标还有其他建议吗?
我不想创建预渲染的背景图像,因为我需要它在 iPhone 3GS、4 和 iPad 上工作,它们都需要不同的背景图像。
I want to create a UILabel
and set its background to the gradient-blue like a selected UITableViewCell
. I suspect I need to use UIColor colorWithPatternImage:
. If yes, I am not sure what the best way to get the pattern image is. Or, any other suggestions on how to accomplish this?
I would prefer not to create a pre-rendered background image since I need this to work on iPhone 3GS, 4 and iPad which all will require different background images.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
Apple 使用的图像是 UITableSelection.png。我已附上标准图像和@2x 图像。
The image used by Apple is UITableSelection.png. I have attached the standard and @2x images.
关于自定义单元格外观的很酷的帖子...
http:// /www.raywenderlich.com/2033/core-graphics-101-lines-rectangles-and-gradients
Cool post here on customising cell appearance...
http://www.raywenderlich.com/2033/core-graphics-101-lines-rectangles-and-gradients
这是一种未记录的颜色,我不确定您是否想使用未记录的颜色。但它被称为
另外,它没有您想要的渐变效果。我认为这是应用于单元格的渐变叠加?我不知道苹果是怎么做到的,但如果你想知道颜色,那就是它。 RGB 值分别为 0.16、0.43、0.83。
It's an undocumented color, I'm not sure if you'd want to use an undocumented color. But it's called
Also, it doesn't have the gradient effects that you want. I assume it's a gradient overlay applied to the cell? I don't know how apple does it, but if you wanted to know the color, that's what it is. the RGB values are 0.16, 0.43, 0.83 respectively.
另请参阅此链接:
http://cloford.com/resources/colours/500col.htm
also refer this link :
http://cloford.com/resources/colours/500col.htm