简体   繁体   English

如何设置UIButton类型?

[英]How to set UIButton type?

A small - little question. 一个小问题。

I have seen many application having buttons like following. 我已经看到许多应用程序具有如下所示的按钮。 替代文字

While using Interface builder I didn't Found any option to have this kind of button. 在使用“界面生成器”时,我没有找到具有这种按钮的任何选项。 How to have this kind of button in your application. 如何在您的应用程序中使用这种按钮。

Almost invariably these styles are done using bitmap images or for the more thrifty of memory, CAGradientLayer . 这些样式几乎总是使用位图图像或为了节省内存而使用CAGradientLayer来完成的

To do it with CAGradientLayer, you would do something very much like the way the gradient and shadows are done in this blog entry . 要使用CAGradientLayer做到这一点,您将非常类似于此博客条目中完成渐变和阴影的方式。

See UICatalog example -> Buttons. 参见UICatalog示例->按钮。 You will find there this kind of buttons. 您会在这里找到这种按钮。 Usually they're done using png images for pressed & normal states. 通常,它们是使用png图像完成按下和正常状态的操作。 I think you can do it in IB by binding a png image to pressed & normal states, but the example in UICatalog is pretty clear and can be used "as is" 我认为您可以通过将png图像绑定到按下和正常状态来在IB中完成此操作,但是UICatalog中的示例非常清楚,可以“按原样”使用

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM