suppress keyboard in iphone UiWebViews
I hav开发者_JAVA技巧e an app that uses UiWebViews, and I need to not show the keyboard for a text field within such a view. I provide my own buttons that insert the limited sorts of text the field allows, but I also need to allow pasting (I will filter what gets pasted) and adjusting the cursor position. Any way to do this?
It looks like this can't be done, I've researched it further and that's pretty clear. I don't want to accept a wrong answer, so I figured I'd just answer this myself and say: can't be done.
if you just want the textField do normal things except the showing keyboard action, you could subclass UITextField
and overwrite the touchesBegan/Moved/Ended
, just call super touchesBegan/Moved/Ended
and add additional code which would hide the keyboard, if you have a reference to the keyboard ( you may figure it out urself how-to ), call the method : [keyboard resignFirstResponder]
, you may try to Category the UITextField
class so you would have the reference to the keyboard ( if it's private ) - but not recommended because categorying may break our project design, but if you just need it for the only purpose, give it a try. Hope it helps.
精彩评论