Interface Builder(iPhone dev)自定义按钮背景图像不尊重拉伸设置 [英] Interface Builder (iPhone dev) custom button background Image does not respect Stretching settings

查看:83
本文介绍了Interface Builder(iPhone dev)自定义按钮背景图像不尊重拉伸设置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用Interface Builder中的背景图像创建自定义按钮。图像具有可伸缩和不可伸缩的部分,因此可以调整大小。

I'm attempting to create a custom button using a background image in Interface Builder. The image has stretchable and non-stretchable parts so that it can be resized.

IB公开拉伸属性以允许这样做,但是我放入的值没有影响如何按钮出现。它总是被完全拉伸以填充框架的大小。

IB exposes the Stretching properties to allow for this, yet no values I put in affect how the button appears. It is always fully stretched to fill the size of the frame.

这可能是IB或UIButton中不支持的功能吗?

Is this this a unsupported feature in IB or in UIButton perhaps?

http://img.skitch.com/20100103-rjabkq2c2jkqynw47crxepdtwb.jpg

(注意:上面的拉伸值不适用于图像,但只是我在屏幕截图时弄乱的值)

(Note: The above stretch values are not the ones that will work with the image properly, but just the values I was messing with at the time of the screenshot)

推荐答案

开始iPhone 3开发的示例中,只有 UIImage leftCapWidth topCapHeight ,并以编程方式创建/设置图像,因此如果contentStretch不起作用,这是另一种方法。

In the example in Beginning iPhone 3 Development only the UIImage leftCapWidth and topCapHeight are used, and the image is created/set programmatically, so that's an alternate method if contentStretch isn't working.

这篇关于Interface Builder(iPhone dev)自定义按钮背景图像不尊重拉伸设置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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