keeping iphone keyboard on screen and change its enter button name - iphone

i want to show my keyboard on screen , whenever a view is shown i.e my login screen..
and i also want to change the name of enter button to Login button.
please help

To change the return key value, change the UIReturnKeyType enum (UITextInputTraits).
If you want the keyboard to show on the screen when it loads, you need to hook up your UITextField to the delegate and include UITextFieldDelegate in your header file. (That is assuming you are using a UITextField.)
Then call:
[textField becomeFirstResponder]
in your viewWillAppear method to give focus to the UITextField which then raises the keyboard.

Related

Custom UIKeyboard

Will really appreciate this if you can help me.Want to create a custom Keyboard that is compatible from iOS 3.0 and onwards.When click on the UITextField want to show my own keyboard.UItextfield inputView is being called on iOS > 3.0.
I have made a custom keyboard in my app. I created it in interface builder and made some class files for it. In the class files I created a protocol to call some delegate methods when the user presses on different buttons of the keyboard. In your view that you want to have your keyboard, just add a UITextField that is of location and size (0,0,0,0). The textfield will only serve as a mechanism to bring up your keyboard. Then in viewDidLoad or at an appropriate time you can set your UITextFields input view like this:
self.myTextField.inputView = self.myKeyboard.view;
Don't forget to set yourself as the delegate of your own keyboard.
self.myKeyboard.delegate = self;
Then when the user does something which warrants bringing up the keyboard, just call becomeFirstResponder on your keyboard. The key is to do it on the textField. Since your keyboard is the input view, it will come up instead.
[self.myTextField becomeFirstResponder];
When you want to dismiss it just resign it.
[self.myTextField resignFirstResponder];
and any buttons that your user clicks on on your keyboard should be handled by delegation.
Good luck to you.

On click event of a keyboard

When you click on a textfield in your iphone application, you will get the keyboard displayed. On that keyboard you will get a GO, DONE and SEARCH buttons. I need to get the On click event of these buttons.
What are they ?
become the delegate of the text field in question and you get sent
-(BOOL)textFieldShouldReturn:(UITextField *)textField
When the user taps the return button, whatever the label on the button is. (GO, SEARCH or DONE)

Hide a custom iPhone control when another portion of the screen is tapped

My problem is thus: I've created a custom view, a numeric keypad, that I display when a button is pressed. When anywhere else on the screen is tapped, I want to hide the keypad.
I solved the problem by overriding touchesBegan:withEvent. Then a hit test tells me if the numeric keypad was pressed. As long as the keypad wasn't pressed, I hide it (by setting its hidden property to YES).
It works, but I don't like it. Its not very clean. My other option is to have a view controller for the numeric keypad and display it as a modal view controller. The keypad view would have a transparent background. I don't like this method either.
Any ideas?
A simple solution would be to have an invisible UIButton that you add to the view when the keypad comes up and remove along with the keypad when it is tapped.
Of course, the tap you get on the UIButton will prevent you from using that tap for anything else, so your interface wouldn't work while the keypad is there.

iPhone: how can I activate a text field programmatically (and not wait for the user to touch it)

I have a UIViewController that is a UITextFieldDelegate, and I would like the keyboard for its text field to appear as soon as the user navigates to this view, without having to actually touch the text field. It would also be nice to be able to "dismiss" the entire view when the keyboard is dismissed. I am loading the view from a xib file.
I don't have an ivar in the code for the UITextField as yet. I would guess I need one. At this point I am just relying on the delegate to pop up the keyboard.
(I know its not a UITextViewDelegate, like the tag says, but I am new to stackoverflow and can't create the correct UITextFieldDelegate tag.)
Sounds like you want to use [textField becomeFirstResponder] in viewDidAppear.

UITextFieldDelegate != IBAction backgroundTap

The scope of this question is IPhone 3.1 sdk (app running in simulator still)
I have a table view that has a cell with a UITextField in that cell. The table view is grouped, and has one section with just a couple fields. Im NOT using IB so backgroundTap is out of the question (as far as i can tell at least). When i click the text field, keyboard shows. Hiding it is still troublesome. Ive pulled the UITextFieldDelegate into the mix to hide the keyboard but the textFieldShouldEndEditing method doesnt seem to fire when the background is tapped (when i mean background, im tapping outside of the grouped table view section). First off, should it?
textFieldShouldReturn fires with no problem and i can resign at this point but shouldnt i be able to resign if focus shifts away from that control?
Any help is much appreciated
-me
Generally you'll only stop editing a field when you:
hit the "Done" or action button on the keyboard
begin editing another field
exit the view
have another button on screen that removes focus
From any of these, you can call -[textField resignFirstResponder] to dismiss the keyboard and call your -textFieldShouldEndEditing: method. There's no reason that just tapping on a non-active part of the screen should dismiss the keyboard.