Iphone Simulator Onscreen Keyboard Issue - ios

I am making a Login Screen for my ViewBased Application.I am having a problem, when i click on the UITextField the onscreen screen pops up as it should. But when i am done with typing the Onscreen Keyboard is not removing from the screen.
Can any one suggest me how can i solve this issue?
Thanks in advance

set the delegate of the UITextField to ViewController class. Override textfieldShouldReturn and call resignFirstResponder...
- (BOOL)textFieldShouldReturn:(UITextField *)textField {
[textField resignFirstResponder];
return NO;
}
EDIT:
After seeing the comment It seems you are a beginner...This blog post tells about UITextField and delegates..Also when you have time, please read this post too (to learn about protocols and delegates..)

Related

How do I present a JSQMessagesViewController with the keyboard already up?

I'm using an open source messaging UI library for an app that I'm building. When users start a new conversation I want the "chat view" to appear with the keyboard already up and the cursor on the textfield (similar to most existing chat applications). Is there a way to force the JSQMessagesViewController to appear with the keyboard already up?
I tried implementing this using:
self.keyboardController.textView.becomeFirstResponder()
However, this caused the keyboard to pop up immediately when the view was presented... yet the toolbar would lag behind by about a second (not too much, but painfully noticeable). In addition, this solution seems to disable the keyboard from being dismissed using a downward gesture as it normally does.
Is there something I'm missing that solves this out of box? Or will I have to modify the library to get this bit of functionality... and if so, where do I begin doing that?
try to do like this
-(void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:YES];
[myTextField becomeFirstResponder];
}
--> It will make focus on myTextField and open the keyboard automatically. Hope it may help you.
This worked for me. It's in swift, but should be easy to translate.
override func viewDidAppear(animated: Bool) {
super.viewDidAppear(false)
self.inputToolbar!.contentView!.textView!.becomeFirstResponder()
}
I wanted this with a button click so I added:
[self.inputToolbar.contentView.textView becomeFirstResponder];
If you want yours when it loads add:
- (void)viewDidAppear:(BOOL)animated {
[super viewDidAppear:animated];
[self.inputToolbar.contentView.textView becomeFirstResponder];
}
This maybe too late, but in my case I forgot to call super.viewDidAppear(animated) which caused text view to lag behind keyboard. Once I added that call, problem went away.

Custom inputView breaks apart when UITextField is enabled in iOS

I am working on creating a custom keypad for my iPad app. I created this keypad as a custom inputView and then assigning it to the inputView attribute for each textfield. I built this keypad in storyboard, and when I place the cursor in any textfield, the delegate method:
-(BOOL)textFieldShouldBeginEditing:(UITextField *)textField{
NSLog(#"how about here?");
return YES;
}
gets called, but the keypad for some weird reason breaks up and is spread all over the screen. I have no idea why this is happening.
Here is what the screen looks like when the app first loads:
and here is how the app looks after I place the cursor in a textfield which calls the above method:
Here is what my screen looks like when I turn Autolayout off:
I honestly have no idea why this is happening. What am I doing wrong?
Thanks in advance to all who reply.

How to disable keyboard but enable UITextFields when using UIDatePicker?

This one is kind of hard to explain, so ask any questions you need to clarify the question. I have an iPad app (XCode 4.2, iOS 6, ARC and Storyboards).
In this app, I have a UIPopover that contains a UIView with two (2) UITextFields in it and a UIDatePicker. (see image). When I go to that scene, I have unchecked userInteractionEnabled on both textFields to prevent the keyboard from responding, which works, but doesn't allow the other UITextField to be accessed after the first one. I tried [oFinishTime setInputView:oTimePicker]; but it takes the timepicker and moves it outside of the popover, which is unacceptable.
I have touchUpInside events "wired" for each of the textFields, but neither one gets called when tapped due to UserInteractionEnabled being unchecked. I could remedy this whole thing if I could have it enabled and set a flag in the action event.
How can I enable both UITextFields yet prevent the keyboard from showing? I will be happy to post any relevant code you need to see.
May be I did not understand your problem correctly , but it seems like you all you are trying to do is Open a picker on tap and display the value set in UIPicker. You are not really using any functionality of a UItextField. A label or a button might serve the same purpose and save you from doing the extra work of disabling the keyboard.
In any case if you want to use textfield and disable keyboard picker appearing as the input view and have your own input view to it, you could do
-(void)textFieldDidBeginEditing:(UITextField *)textField{
[textField resignFirstResponder];
}
You could take a look at this:
Display datepicker on tapping on textfield
- (BOOL)textFieldShouldBeginEditing:(UITextField *)textField; // return NO to disallow editing.
assign delegate for each textfield and in the delegate method verify if its the one which should open picker instead of keyboard.
If it is the one then return NO
else YES
- (BOOL)textFieldShouldBeginEditing:(UITextField *)textField{
if (textfield == startTimeTextField)
{
[self openPicker];
return NO;
}
return YES;
}

UITextField not getting keyboard input

I'm having troubles entering text into an UITextField under a SVProgressHUD (Basically an UIView with a full-screen transparent UIWindow and some UIView subviews showing text and a custom-drawn progress bar).
My problem is that the UITextField displays the blinking cursor and the keyboard shows, but when I tap a key, nothing is entered into the text field.
I only see that the cursor's blinking interrupts just like normal.
Interestingly enough, the back (delete) key works (it really deletes the last letter in the UITextView), but not any other key.
I'm using iOS 6.
Any help would be highly appreciated.
EDIT:
The same UITextField works fine when there's no SVProgressHUD displayed. This makes me think it has something to do with the first responder, but I have already tried calling resignFirstResponder on every window and subview of the SVProgressHUD and it still does not work.
I finally found the problem:
SVProgressHUD calls makeKeyAndVisible when it's initialized, because it wants to receive keyboard notifications for repositioning. I looked up what the "Key Window" actually is and found out:
...The key window responds to user input...
Now, as the UIWindow of the SVProgressHUD was the keyWindow, my other window, which contained the UITextField did not get the user input.
I finally call makeKeyWindow on the AppDelegate's window and everything is working fine.
I hope this helps anyone with similar problems.
Call resignFirstResponder() to dismiss the keyboard before showing SVProgressHUD.
Have you implemented the method....
- (BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text
...to filter out any unwanted characters? If so, perhaps it's being a little overzealous with the filtering?
For me this is worked.
I did changes in my textfield delegate method then it worked.
if ([textField isEqual:selectBankName])
{
return No;
}
else if ([textField isEqual:enterAmountTextfield])
{
return YES;
}
return NO;
}
set delegate for textfield
Make sure textfield userInteraction is Enabled.And
Finally Please check your textfield delegate method.

iOS keyboard won't dismiss after view dissappears

I have been looking for a similar questions but so far the answer doesn't fit my purposes. I have a UITableViewController inside A UINavigationController with custom UITableViewCells containing textfields inside. When I click on the textfields they become the firstResponders and when I click return they resign it. So far so good.
My problem is one of these cells is performs a Submit function. After this is done whenever I press the textfields the return button doesn't dismiss the keyboard anymore.
My question is, since I'm not releasing anything, why do these textfields stop listening to the resignfirstresponder message?
UPDATE: I finally got this working by setting an UITextfield ivar in the class, making it the first responder whenever the textfield begins editing in :
- (void)textFieldDidBeginEditing:(UITextField *)textField
{
[textField setTextColor:[UIColor blueColor]];
focusedTextField = textField;
}
And calling [focusedTextField endEditing:YES]; when i press the submit button. Just added this after seeing some answer in SO, but I can't remember the link, sorry.
Hope it helps.
If you have declared a method for return(let's say your textfiled is called textField) use this code in your method;
[textField setUserInteractionEnabled:NO];//but this may restric you if you need to use it again
But if you use standard return property of the keyboard it may be something related to Apple's restrictions

Resources