I have an requirement to implement a custom keyboard for a Cocoa Touch data entry screen containing multiple UITextFields. I've built the keyboard, and everything is working except now I need to figure out how to implement a blinking cursor. (When you disable the UITextField's built-in keyboard, you lose the cursor as well). In googling around, I've seen a few mentions of using CALayer animation to do this. However, I have not yet found a simple example of how I might implement this. Since UITextField inherits from UIView, I was hoping I could use the text fields view as the host layer. The animation part of the blink is not what is worrying me, it is just setting this up properly. Any advice, or pointers to other sites containing a simple tutorial? (everything I've found has been oriented toward multi-layers and games, and not built on top of a basic view/textfield).
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
You would have had to basically cycle a animation of a black CAlayer's opacity property from 0 to 1 repeatedly, but now you have custom input views https://developer.apple.com/iphone/library/documentation/General/Conceptual/iPadProgrammingGuide/Text/Text.html#//apple_ref/doc/uid/TP40009370-CH8