iphone - 有没有办法像 stretchableImageWithLeftCapWidth 一样垂直拉伸(stretch)图像?

标签 iphone ios ios4

UIImage 有一个名为“stretchableImageWithLeftCapWidth”的方法,它可以水平缩放图像而不缩放“caps”。

有没有办法垂直地做到这一点?甚至水平和垂直?

SDK 没有向我展示任何可能执行此操作的方法。 Google 也没有提供任何帮助,但也许我正在搜索错误的词。

最佳答案

实际方法是

- (UIImage *)stretchableImageWithLeftCapWidth:(NSInteger)leftCapWidth topCapHeight:(NSInteger)topCapHeight

并且支持任意方向的拉伸(stretch)(不是缩放,两者是不同的概念)。

如果只想垂直拉伸(stretch),则将 leftCapWidth 设置为零,如果只想水平拉伸(stretch),则将 topCapHeight 设置为零。并在两个方向上进行适当的设置。

关于iphone - 有没有办法像 stretchableImageWithLeftCapWidth 一样垂直拉伸(stretch)图像?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6735048/

相关文章:

iphone - 如何将选定的 UITableViewController 值添加到以前的 UITableViewController?

iphone - 获取在 iOS UIFont 中追踪字符的路径

objective-c - 管理可索引字符串列表的最佳实践?

objective-c - Objective-C : How to maintain image resolution/quality in navigation buttons and tab bars

iphone - 如何在iPhone中启用 "show Touch On highlight"?

iphone - 如何在 iOS 上使用不同字体大小对齐 UILabels 中的文本基线?

iphone - 仅在 320x480 区域检测到 iPad touch

ios - 从继承类访问父类(super class)属性

ios - UITouchUpInside 不调用委托(delegate)方法

iphone - 许多 CLLocationManager 实例