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

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

问题描述

可能的重复:
在 iPhone 应用中手动绘制渐变?

我的应用程序需要在 UIViewUILabel 中显示文本,但背景必须是渐变而不是真正的 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.

推荐答案

你也可以使用一个一像素宽的图形图像作为渐变,并设置 view 属性来扩展图形以填充视图(假设你正在考虑一个简单的线性渐变,而不是某种径向图形).

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).

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

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