i created persian custom keyboard , my letters type on UITextView , but the UITextView dosn't support paste function ! why ? i don't check the editable option .
In your UITextViewDelegate, you can try implementing textView:shouldChangeTextInRange:replacementText: to see what, if any, text is being pasted. I'm not sure if it's going to be called on the paste event though.
If the text view isn't editable, the user can't paste to it.
Related
when we click the text field, the default keyboard or keypad not to be appear instead i need to display the custom keyboard..
Did any one know the answer please post it..
Declared in
UIResponder.h
UIInputViewAudioFeedback protocol.
Is this method correct or else there having any simple method to work out?
You need to create a protocol for this for having a custom keypad appearing throughout the app. I have made it few months back and the stuff was working well. My requirement was to create a keyboard for farsi language, because ios does not have farsi in its language settings.
There is no need to make protocol if you want it in just 1 viewcontroller.
Here is my that thread:
customized keypad on the iPhone Application
Here's something that I created that might help. Just fork it on GitHub and change the Punjabi characters to Myanmar. Most of the hard work is done for you :)
https://github.com/kulpreetchilana/Custom-iOS-Keyboards
Per your comment you need the Number Pad keyboard.
Set your UITextField keyboardType property, either via Interface Builder or programmatically:
textfield.keyboardType = UIKeyboardTypeNumberPad;
I have 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.
I'm trying to get a UITextView (NOT a UITextField) to act as a password field where the text is obfuscated as you type into it. However, setting this property to YES on a UITextView seems to have no effect and the letters are always visible instead of only being visible if it's the last letter typed and a dot otherwise. Has anyone else run into this and know why this happens or what a possible workaround may be? If necessary I can use a UITextField in the instances that I specifically need password behavior but that would not be as clean as just using UITextView only. Thanks!
I think that specific UITextInputTraits simply does not work on the UITextView. It is intended for password fields (UITextField).
I have an iPhone app with a UITextView. I'd like to be able to paste the clipboard contents into it without showing the UIMenuController.
I tried calling the paste: method on the UITextView, and on the first responder, but neither of those things worked.
I was able to implement this by writing a bunch of code to read text from the clipboard, insert it in the UITextView's text property, and update the selection range. I also added support for undo/redo. But it seems like there ought to be an easier way. Is there?
Did you try paste with nil sender?
[theTextView paste:nil];
as per UIResponder docs
Did you try making the UITextView the first responder?
I checked out the headers to the UITextView object, but I couldn't find any documented method called -paste; also, looking over the NSPasteboard class suggests to me that programatically setting your text was the right way to go.
If pasting text is important to your app, I would consider setting up a class to handle it; maybe even make it a singleton if it was important enough.
Good luck!
I'm using an UITextView to hold static content (in Chinese, which means that the characters are all fixed width). I want to let users click on a character in the text and bring up dictionary information for that character. I know all of the issues surrounding the lack of copy and paste and all that, but I'm hoping that there will be a way to do this without waiting for the iPhone 3.0 firmware.
At first, I thought about using UITextViews selectedIndex property. Unfortunately, when the UITextView is not editable, the following code in the UITextView's always returns the length of the entire text block:
NSRange touchPoint = self.selectedRange;
NSLog(#"Selection: %d", touchPoint.location);
This makes sense, I suppose, as with a non-editable UITextView there's no way to select an insertion point, but it's doesn't help me any. :)
Another approach would be to calculate, using the fact that the Chinese text is fixed width, where the click landed and what text should be under that location at the time, but this is complicated by punctuation which can cause a line to wrap early, bringing preceding characters down a line.
Is there another way of know what text is under a touch event that I'm missing?
Call the following before asking for the selectedRange:
[[textView webView] updateSelectionWithPoint:point];
Note: Both -webView and -updateSelectionWithPoint: are private APIs. You can alsoperform the equivalent behavior by toggling editable, becoming first responder and sending fake touch events, but that would be much more work