iOS UIButton 如何制作这样漂亮的按钮?
这是一个 UIButton 吗?如果是的话,背景红色是怎么做的?显然,它不是 红色 UI 颜色? Xcode 中是否包含相同的工具或实用程序来允许制作按钮 像这样?
Is this a UIButton? If it is, how is the background red done? Obviously, it is not
red UIColor? Is there same tool or utility included with Xcode to allow making buttons
like this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
更多
发布评论
评论(5)
您可以使用私有类
UIGlassButton
生成类似的按钮。我首先在这里看到它 http://pastie.org/830884 作者:@schwa。
在 iOS 模拟器中运行使用此代码的应用程序以创建自定义按钮(或在设备中,保存到 $(APP)/Documents 并启用 iTunes 文件共享)。
获得 png 后,将其用作按钮背景。
或者,您可以以编程方式构建按钮(作者:Jeff Lamarche)。
You can generate similar buttons with private class
UIGlassButton
.I saw it first here http://pastie.org/830884 by @schwa.
Run an app with this code in your iOS simulator to create a custom button (or in the device, save to $(APP)/Documents and enable iTunes file sharing).
Once you obtain the png, use it as button background.
Alternatively, you can build the buttons programmatically (by Jeff Lamarche).
我编写了几个类来为我编写的计算器生成按钮。这些类根据标准颜色或 RGB 输入 RGB 值生成按钮。这些按钮位于我在 Github 上的 BindleKit 项目中: https://github.com/bindle/BindleKit
回答更改 UIButton 背景color 描述了如何使用这些类以及在哪里可以找到源代码。
要查看按钮的示例,请在 Github 项目中编译 BKCatalog 应用程序或查看屏幕截图 https://github.com/bindle/BindleKit/blob/master/screenshots/BKCatalog-BKButtons.png
I wrote a couple of classes to generate buttons for a calculator I wrote. The classes generate the buttons based upon either standard colors or with RGB input RGB values. The buttons are in my BindleKit project on Github: https://github.com/bindle/BindleKit
My answer to Change UIButton background color describes how to use the classes and where to find the source.
To see examples of the buttons, compile the BKCatalog app in the Github project or look at the screenshot https://github.com/bindle/BindleKit/blob/master/screenshots/BKCatalog-BKButtons.png
您需要为按钮创建背景图像。
然后将图像添加到按钮:
对于可调整大小的按钮,请参阅:
您可以使用 Graphics Converter、Photoshop 等程序。
You need to create a background image for the button.
Then add the image to the button:
Also for resizable buttons see:
You can use programs like Graphics Converter, Photoshop and others.
在 iOS 5 下,你有 UIAppearance。
And under iOS 5, you have UIAppearance.
您可以使用核心动画层制作一个类似的按钮。
http://www.cimgf。 com/2010/01/28/fun-with-uibuttons-and-core-animation-layers/
You can make a button like that with core animation layers.
http://www.cimgf.com/2010/01/28/fun-with-uibuttons-and-core-animation-layers/