【发布时间】:2015-07-04 21:08:20
【问题描述】:
在 iOS 应用程序中,我有 250x85pt UIView。我希望它具有基于图像的平铺背景。原始图像为 398x398 像素。我想平铺我的图像。
当我运行应用程序时,我的图像平铺,但由于某种原因,它按如下方式缩放:
我使用下面的代码来实现它:
var image = UIImage(contentsOfFile: "myfilepath.png")!
var uicolor = UIColor(patternImage: image)
uiview.backgroundColor = uicolor
你能解释一下吗 1. 为什么 ios 会缩放我的图像,以及 2. 不缩放怎么画平铺图?
【问题讨论】:
-
请不要将您的
var命名为“uicolor”...