如何复制iOS键盘外观? [英] How do I replicate the iOS keyboard appearance?

查看:134
本文介绍了如何复制iOS键盘外观?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我为我的iOS应用程序制作了自定义数字键盘键盘,但希望它更接近镜像标准键盘的外观。我正在寻找有关如何制作标准UIButton外观并像标准键盘按钮一样的建议。

I have made a custom number pad keypad for my iOS app, but want it to more closely mirror the appearance of the standard keyboard. I am looking for advice on how to make a standard UIButton look and act like the standard keyboard buttons.

具体来说,我需要弄清楚iPad的以下内容喜欢在xib或storyboard中尽可能多地做。

Specifically, I need to figure out the following for the iPad and would like to do as much as possible in an xib or storyboard.


  • 按钮的大小

  • 键盘背景的颜色(甚至更好,我如何自己确定?)

  • 按钮的背景颜色

  • 字体和按钮中文本的颜色

  • 如何在按钮下添加阴影?

  • 如何使用灰色突出显示按钮颜色而不是蓝色?

  • 按钮之间的间距

  • 如何在更改方向时将按钮的组保持为中心整体? (所有调整大小选项将其锚定在一边而不是彼此关联)

  • The size of the buttons
  • The color of the keyboard background (or even better, how can I determine this myself?)
  • The background color of the button
  • The font and color of the text in the button
  • How do I add the shadow under the button?
  • How do I have the button highlight with the grey color instead of blue?
  • The spacing between the buttons
  • How do I keep the "group" of buttons centered as a whole when changing the orientation? (all of the resizing options anchor it to a side and not to each other)

标准按钮是使用图像,还是它们是修改标准UIButton的?或者更合适的是,这对我们来说更好吗?

Do the standard buttons use images, or do they modify standard UIButton's? Or more appropriately, which is better for us to do?

更新:

我已经创建了一个项目数字键盘是一个完整的工作示例。但是,我没有花太多时间在实际外观上,这就是这个问题的主要内容。我已经将它发布在Github上并使其成为一个开源项目(由MIT许可证覆盖,因此也允许商业用途)。希望其他人会发现它很有用,希望其他人会倾向于帮助它变得更好,看起来更像原生键盘。 Github存储库位于:

UPDATE:
I have created a project for the number pad which is a complete working example. However, I have not spent much time on the actual appearance, which is what this question was mainly about. I have posted it on Github and made it an open source project (covered by the MIT licence, so commercial use is allowed as well). Hopefully other people will find it useful, and hopefully others will feel inclined to help make it better and look more like the native keyboard. The Github repository is at:

https:// github。 com / lnafziger / Numberpad

推荐答案

如果你想在IB中主要做这件事,那么可以做以下几点:

If you want to do it mostly in IB, then the following can be done:


  • 尺寸

  • 颜色

  • 背景颜色

  • 字体

  • 文字颜色

  • 阴影(对UILabel不是UITextArea)

  • 间距

  • 自动调整大小

  • Size
  • Colours
  • Background Color
  • Font
  • Text Color
  • Shadow (to UILabel's not UITextArea)
  • Spacing
  • AutoSizing

有一个很酷的PSD矢量套件适用于所有类型的iOS元素应该有所帮助:

There is a cool PSD vector kit for all types of iOS elements that should help:

http://www.smashingmagazine.com/2008/11/26/iphone-psd-vector-kit/

无论如何,对于其余的答案:

Anyway, to the rest of the answers:

截取按钮的屏幕截图并确定尺寸在Photoshop中,或者您可以在图像文件上使用CMD + i看到像素尺寸。记得使用CMD + Shift + 4然后拖动(然后用空格来制作屏幕截图)。

Take a screenshot of the buttons and determine the size in Photoshop, or you can use CMD+i on the image file to see the pixel dimensions. Remember to use CMD+Shift+4 and then drag (and then Space to make the screenshot).

使用Mac上预装的DigitalColor Meter应用程序,它适用于所有类型的功能。

Use the DigitalColor Meter app that's preinstalled on the Mac, it's pretty cool for all kinds of functions.

实际的UIButton的背景颜色为 [UIColor clear] ,但是整个键盘背景,最好在Photoshop中创建类似的东西,再次使用颜色选择器来获得正确的渐变。然后你可以把它作为背景图像拖到IB中。

The actual UIButton will have a background color of [UIColor clear], however, for the whole keyboard background, it would be best to create something similar in Photoshop and again using color pickers to get the right gradients. Then you could drag this into IB as a background image.

再次看看字体/尝试Helvetica

Again, have a look at fonts/try Helvetica

[UIColor black]



暗影:



以编程方式:

Shadow:

Programmatically:

[text setShadowOffset:(0,1)]; // One option
[text setShadowOffset:(0,-1); // Another option
[text setShadowColor:[UIColor whiteColor]];

但是,您也可以在IB检查器中为UILabel设置阴影。

But, you can also set the shadow in the IB inspector for a UILabel.

查看UIButton引用
http://developer.apple.com/library/ios/#documentation/UIKit/Reference/UIButton_Class/UIButton /UIButton.html

Look at the UIButton reference http://developer.apple.com/library/ios/#documentation/UIKit/Reference/UIButton_Class/UIButton/UIButton.html

如果您使用IB,那么您可以将按钮拖到任何位置.IB有一些自动调整选项,可根据TOP确定按钮的间距,左,右和下。您也可以设置它们是否可伸缩。

If your using IB, then you could just drag on the buttons to whatever location.. IB has some autosizing options that determine where the buttons are spaced according to the TOP, LEFT, RIGHT and BOTTOM. You can also set if they are stretchable or not.

这篇关于如何复制iOS键盘外观?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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