UIView和UILabels上的渐变在iPhone [英] Gradients on UIView and UILabels On iPhone

查看:80
本文介绍了UIView和UILabels上的渐变在iPhone的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


可能重复:

在iPhone应用程序中手动绘制渐变

我的应用程序需要在 UIView UILabel 中显示文本,但是背景必须是渐变到真实的 UIColor 。使用图形程序创建所需的外观是不好的,因为文本可能会根据从服务器返回的数据而有所不同。

My application needs to display text in either a UIView or UILabel but the back ground must be a gradient as opposed to a true UIColor. Using a graphics program to create desired look is no good as the text may vary depending on data returned from a server.

有没有人知道最快的方法来解决这个问题?

Does anyone know the quickest way to tackle this? Your thoughts are greatly appreciated.

推荐答案

您还可以使用一个像素宽的图形图像作为渐变,设置视图属性以展开图形以填充视图(假设您正在考虑一个简单的线性渐变,而不是某种径向图形)。

You could also use a graphic image one pixel wide as the gradient, and set the view property to expand the graphic to fill the view (assuming you are thinking of a simple linear gradient and not some kind of radial graphic).

这篇关于UIView和UILabels上的渐变在iPhone的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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