关于如何在Xcode 4.2中自定义UIButtons的Interface Builder教程 [英] Interface Builder tutorial on how to customize UIButtons in Xcode 4.2

查看:88
本文介绍了关于如何在Xcode 4.2中自定义UIButtons的Interface Builder教程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试构建一个iPad应用程序,当按钮被选中,内部,外部等触摸时,使用自定义图像作为按钮和我自己的自定义行为。



<我正在尝试使用Interface Builder来执行此操作,但我对各种文本字段的含义有很多疑问,例如背景图像,阴影颜色,阴影偏移,高光色调,绘图等。



有没有人知道在Interface Builder上有一个超过UIBUttons的好教程?

解决方案

我遇到的最好的在线自定义按钮教程可能是 http://ios-blog.co.uk/iphone-development-tutorials/how-to-code-custom-ios-buttons/ 。它解释了图像拉伸的工作原理,大写参数的表现非常好,并且用简单的英语表达。 (离线,除其他外,我推荐Dave Mark和Jeff LaMarche的开始iPhone 3开发中的 Spiffing Up the Button 部分(第92页) - 当然,如果你有这本书的话。 )我还没有找到足够详细的其他在线教程 - 通常,它们只提供一些代码,但没有图像拉伸解释。在进入我已经链接到的教程之前,我花了很多时间来试验如何呈现图像。



一些额外的示例代码解释了这四个不同的按钮状态包括以编程方式设置按钮背景图像


I'm trying to build an iPad app that uses custom images as buttons with my own custom behaviors when the buttons are selected, touched up inside, outside, etc.

I'm trying to use Interface Builder to do this, but I have a lot of questions as to what the various text fields mean such as Background Image, Shadow Color, Shadow Offset, Highlight Tint, Drawing, etc.

Does anyone know of a good tutorial that goes over UIBUttons on Interface Builder?

解决方案

Probably the best online custom button tutorial I've run into is at http://ios-blog.co.uk/iphone-development-tutorials/how-to-code-custom-ios-buttons/ . It explains how image stretching works, what the "caps" parameters are pretty well and in plain English. (Offline, among other things, I recommend the "Spiffing Up the Button" section (pg. 92) of Beginning iPhone 3 Development by Dave Mark and Jeff LaMarche – if you have the book, of course.) I haven't found the other online tutorials verbose enough – generally, they only present some code, but no image stretching explanation. Before running into the tutorial I've linked to, it took me quite a bit of experimenting to find out how images should be presented.

Some additional example code explaining the four different button states are at, among others, Set a button background image iPhone programmatically

这篇关于关于如何在Xcode 4.2中自定义UIButtons的Interface Builder教程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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