简体   繁体   English

创建类似PassCode功能的UI(请参考Dropbox应用程序作为参考)

[英]Create UI like PassCode functionality (as reference look at dropbox application)

I am new to the iOS SDK. 我是iOS SDK的新手。 I have a requirement to create a UI similar to the passcode entry in the Dropbox application. 我需要创建一个类似于Dropbox应用程序中的密码条目的UI。 I have few questions as below: 我有几个问题,如下所示:

  1. How to create secure text field which does not show cursor blinking on that? 如何创建不显示光标闪烁的安全文本字段?
  2. How to create numberic keyboard which is always available on particular UIViewController? 如何创建始终在特定UIViewController上可用的数字键盘?
  3. How to receive event of keyboard key press so I can set pressed value in particular text field? 如何接收键盘按键事件,以便可以在特定的文本字段中设置按键值?

I have read a number of posts and articles on this, but none of those are helpful to me. 我已经阅读了许多与此相关的文章和文章,但是这些文章和文章都对我没有帮助。 Some posts has technique like create one dummy text field invisible and keyboard is attached to this textfield. 一些帖子具有创建一个不可见的虚拟文本字段并将键盘连接到该文本字段的技术。 For every entry in this text field update four passcode entry text fields accordingly. 对于此文本字段中的每个条目,相应地更新四个密码条目文本字段。

I hope answers to above question will help me to create same passcode entry UI. 我希望上述问题的答案将有助于我创建相同的密码输入用户界面。

You might take a look at existing implementations like KKPasscodeLock , EAPasscodeLock or pinview . 您可能会看看KKPasscodeLockEAPasscodeLockpinview等现有的实现。 You can download these for free and take a look at the source code (or just use the code in your own app). 您可以免费下载它们并查看源代码(或仅在自己的应用程序中使用代码)。

Maybe do it like the Calculator app? 也许像计算器应用一样? You make a View with a TextField(non-editable/secure) and lots of Buttons and don't use any keyboard. 您使用TextField(不可编辑/安全)和许多Button创建一个View,并且不使用任何键盘。 If you hit the buttons you add the according character to the TextField, if you hit some kind of remove-button you remove last character in TextField. 如果单击按钮,则将相应字符添加到TextField中;如果单击某种删除按钮,则将删除TextField中的最后一个字符。

If you want a more nicely fashioned text, you could hide the textfield and display dots in a textView(non-editable) according to the length of the string in the hidden textfield. 如果您想要更时尚的文本,则可以隐藏文本字段,并根据隐藏的文本字段中字符串的长度在textView中显示点(不可编辑)。

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

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