i have developed a custom keyboard app of iOS8. and i can't get the text from input view. any help will be appreciated .
have tried to use
- (void)textDidChange:(id<UITextInput>)textInput {}
delegate to get text. but it returns null value. i don't have another idea from which i can get text from input view
thanks in advance
i am able to get string from input view of custom keyboard of iOS 8 . here is the line of code which will return the string
NSString *strBeforeCursor=[self.textDocumentProxy documentContextBeforeInput];
NSString *strAfterCursor=[self.textDocumentProxy documentContextAfterInput];
thanks
Related
I'm making an app and I want the user to be able to input text without having them actually click on a UITextField (have it open after the game ends for a scoreboard), is there some way to do that?
Call the following in the viewDidLoad of scoreboard, or whatever the entry point of that view is.
yourTextField.becomeFirstResponder()
Yes, just:
<#your_text_field#>.becomeFirstResponder()
after the game ends.
This will produce the "same" effect as a tap on the UITextField. If this is on a new UIViewController you can place it on viewDidAppear, otherwise you can assume everything is already loaded and simply call it anywhere.
i am developing a payment processing iPhone application and also able to read information from card to my app using a card reader device but after reading card information i am unable to show those data to textfields of my view it displays only after tapping on textfields
please see if anyone can help me...
the code should be something like this:
-(void)showCard{
nsstring *cardnumber = [[nsstring alloc]initwithformat:#"%#", cardData];
self.textField.text = cardnumber;}
thats how i do it and for me it automatically shows it
make sure that its not in an action where you tap the text field and that its in its own method
Sounds like the code to update the field is in the wrong place. If you have put the code in the delegate method
textFielDdidBeginEditing
the code would not be ran until the textField gains focus through an event such as a tap.
Try moving it into its own method that is called whenever the card reader has finished.
I have a screen that has a UITextField and a button. i got the code down to check if the password is correct, the only thing i need is some help to navigate screens. every tutorial i see uses XIB screens and i am using storyboard. Some help would be greatly appreciated. this is the code to check the textField:
-(IBAction)checkField:(id)sender{
NSString *pass = #"apc";
if([pass isEqualToString:password.text]){
//Enter code to let storyboard know if its right or not?
}else{
//Make a pop-up dialog(least of my worries right now!)
}
}
any help would be greatly appreciated. if you need to see more of my code to help just please ask !!!!!
Preparation
Create a custom segue in your storyboard, which tells the code where to go. You can simply drag a segue by holding ctrl. Drag it from one view to another view, but don't drag it from a button or something. Use the views themselves.
Give the segue a name (identifier) by clicking it and giving it a name.
Execution
Simply call [self performSegueWithIdentifier:#"identifier" sender:self];
And that's it :-)
I wan't to creata a "CatchNames" class which I can import into a view Controller that shows a text which asks for text input. I would like to be able to add an instance of CatchNames to my view, have it ask the user for three names in a row and return them in an array.
[self.view addSubview:[catchNames view]];
NSArray *myNamesArray = [catchNames namesArray];
The best way would be to have the application freeze kind of the way it does when you are prompted to enter a password in iOS and continue when the user entered 3 names so I can immediately catch the array in the next line.
While this might not be the best description I still hope you understand my problem.
How can I approach this?
Thank you in advance
I guess you appear to be looking to implement a simple form which gets the user input, retrieves and stores it in an array? Hopefully I haven't misunderstood the question, but this seems to be a simple task you can accomplish with one or more UITextField's and a UIButton as a 'Add' or 'Done' call to action.
Are you looking for some general UI coding level help regarding implementing such a view? If so, I would encourage taking a look at the XCode documentations of UITextField (for capturing text), UIButton (for handling actions) and UIView (for view hierarchy and animation implementation).
Some quick notes;
Looks like 3 names are compulsory, so, you may verify whether a UITextField is empty at the button's click action.
Have the array declared in the view controller, not the view
The 'freezing' you require should take care of itself as long as the view offers no other way out for the user other than clicking the button.
Do excuse me if I am oversimplifying the problem. Let me know if you need me to drill down into anything further.
Cheers!
I'm trying to save the contents of an UITextView into a NSString which I will somehow persist later.
The problem is that the UITextView "text" property doesn't save all the rows in the textView (after touching "return"). I tried print the TextView object and the textView.text, and they're different.
Does anybody know how (after editing the textView) I can save its content into a String (or something else that I can later access and share through different views and persist in the database)?
Thanks a lot. Pretty sure it is simple, but I'm honestly not finding the solution.
NSString *textViewString = myTextView.text
ought to be what you need. But you say that the TextView object and its text property have different values? Has your delegate received – textViewDidEndEditing: or – textViewDidChange: yet?