问题描述
如果 UIWebView 中的元素具有样式属性 -webkit-user-modify:read-write,则按下该元素会导致键盘出现.是否可以以编程方式调出键盘?
If an element in a UIWebView has the style property -webkit-user-modify:read-write, then pressing on the element causes the keyboard to appear. Is it possible to bring up the keyboard programatically?
谢谢
推荐答案
看起来现在在 iOS6 中你可以使用keyboardDisplayRequiresUserAction"来做到这一点:
It looks like in iOS6 now you can do this with "keyboardDisplayRequiresUserAction":
keyboardDisplayRequiresUserAction一个布尔值,指示网页内容是否可以以编程方式显示键盘.
keyboardDisplayRequiresUserActionA Boolean value indicating whether web content can programmatically display the keyboard.
@property (nonatomic) BOOL keyboardDisplayRequiresUserAction讨论当此属性设置为 YES 时,用户必须明确点击 Web 视图中的元素以显示该元素的键盘(或其他相关输入视图).当设置为 NO 时,元素上的焦点事件会导致显示输入视图并自动与该元素关联.
@property (nonatomic) BOOL keyboardDisplayRequiresUserActionDiscussionWhen this property is set to YES, the user must explicitly tap the elements in the web view to display the keyboard (or other relevant input view) for that element. When set to NO, a focus event on an element causes the input view to be displayed and associated with that element automatically.
此属性的默认值为 YES.
The default value for this property is YES.
可用性在 iOS 6.0 及更高版本中可用.申报在UIWebView.h
AvailabilityAvailable in iOS 6.0 and later.Declared InUIWebView.h
参考:
这篇关于以编程方式在 UIWebView 中显示键盘的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!