Keyboard hides as dialog dissappears - iphone

In my application i am using sharekit inorder to post on Facebook.On main screen i have a textview and a custom keyboard. When i click on Facebook button it will check about the user authentication tokens if present post will be published on Facebook if not it will display a dialog box to get username and password by user. When i click cancel button on that dialog the keyboard automatically hides.
My problems is I dont want keyboard to get hide. I had also used observer
[[NSNotificationCenter defaultCenter] addObserver:self
selector:#selector(keyboardWillShow:)
name:UIKeyboardDidShowNotification
object:nil];
This observer will show keyboard.
The observer always called method keyboardWillShow but in case of dialog it wont. And my keyboard automatically hides when I cancel the dialog.And I am using iOS6 in iOS5 the same observer is working fine.

In that cancel method write code like below
[yourview endEditing:NO];
let me know is it working or not....
Happy Coding!!!!!!

Related

keyboard dismiss without animation when used in UIWindow with windowLevel greater than UIWindowLevelAlert

I am currently presenting a security code view controller that contains a UITextField in which the user is supposed to enter a passcode. This security code view controller is presented in its own window which has a "windowLevel = UIWindowLevelAlert + 1;" because i want to hide potential UIAlertView or other windows that could be present already displayed.
The problem comes when i call the resignFirstResponder method on the textfield, it seems that the keyboard is dismissed without the usual animation.
I tried to register to the various keyboard notification, and checked the UIView areAnimationsEnabled property and it returns YES.
So if anybody already had this issue, you're welcome :)
UIKeyboardAnimationDurationUserInfoKey is a constant string identifier the animation duration, so there is where of enabling and disabling the animation.
[[NSNotificationCenter defaultCenter] addObserver:self
selector:#selector(willHideKeyboard:)
name:UIKeyboardWillHideNotification
object:nil];
- (void)willHideKeyboard:(NSNotification *)notification {
[UIView setAnimationsEnabled:NO];
}

How to get event or notification of the input method changing?(IOS5.1)

(In IOS 5.1 Xcode 4.3)
When the user clicked the button to switch keyboard input method, how to get to this event and to determine the state of the input method?
When the input method changes, although the keyboard is already there, iOS will send the UIKeyboardDidShowNotification. You can register yourself for this notification like:
[[NSNotificationCenter defaultCenter] addObserver:self
selector:#selector(keyboardDidShow:)
name:UIKeyboardDidShowNotification
object:nil];
Thats actually all you can do from my point of view!
I'm not sure if it's possible to detect the current input method of the keyboard directly!
Or maybte take a look at the following discussion: Detecting current iPhone input language!

Default Keyboard appears in iPhone instead of my custom keyboard

I am making a custom keyboard in my app for iPhone. But when I tap on the UITextField the default keyboard also appears. Where as I want only my keyboard to pop-up on the screen. How do I stop default keyboard from appearing on the screen?
You can try the following line of code
your_TextField.inputView = your_CustomKeyboard;
I am not confirm that it will work for your custom Keyboard i tried this to use a datepicker as inputview and it did worked so it may help you
I got the answer to my question. Since I am new here i cudnt post an answer b4 8 hrs after my own question post. And yes Tejeshwar Gill, Thanks for the response and my solution matches your approach. Thanks again.
I used the NSNotificationCenter to notify me when the keyboard appears. I had used this method to resize my tableview when the keyboard appears, but that was quite some time before. So it didnt click me instantly then.
[[NSNotificationCenter defaultCenter] addObserver:self
selector:#selector(hideKeyboard:)
name:UIKeyboardWillShowNotification
object:nil];
You need to hide the default keyboard inorder to show your custom keyboard. So use this:-
[[NSNotificationCenter defaultCenter] addObserver:self selector:#selector(keyboardDidHide:) name:UIKeyboardDidHideNotification object:nil]; and in the method keyboardDidHide: , add [keyboard resignFirstResponder].

prevent UIWebView inputs from displaying UIKeyboard without disabling user interaction

I have a UIWebView that loads and external product configuration web service UI that is basically a bunch of dependent Drop Down lists.
The problem is the Drop Downs are basically enhanced text input's so when the user taps them to display the options the UIKeyboard keeps popping up and own after they make their selection. it is less than a fluid process. Is there anyway to suppress the html inputs from triggering the UIKeyboard?
Then try this:
...
[[NSNotificationCenter defaultCenter] addObserver:self selector:#selector(removeKeyBoard:) name:UIKeyboardDidShowNotification object:nil];
...
- (void)removeKeyBoard:(NSNotification *)notify {
// web is your UIWebView
[web stringByEvaluatingJavaScriptFromString:#"document.activeElement.blur()"];
}
remember to remove the notification and can filter it if only for your WebView object.
Try using the following code in the HTML:
<input type='text' width='100' onclick='blur()'>
with the method blur () and then you lose the focus will not appear on the keyboard.

Can I disable the keyboard from showing in a UIWebView?

Is it possible to disable the keyboard from showing when a webpage element is selected inside a UIWebView?
Register for a keyboard notification:
[[NSNotificationCenter defaultCenter] addObserver:self selector:#selector(keyboardWillShow) name:UIKeyboardWillShowNotification object:nil];
And then you can stop it from showing by placing the following code in keyboardWillShow :
UITextField *dummyTextField = etc.
//Basically, create a dummy uitextfield that you never show.
//I can't remember all the syntax :)
[dummyTextField becomeFirstResponder];
[dummyTextField resignFirstResponder];
//Keyboard should be gone. Hoorah!
Not sure 100% if this will work without flaws. If the keyboard starts to animate then hides itself again, you could use
[UIView enableAnimations:NO];
If the keyboard doesn't like being resigned while it's showing then you could try changing the inputView property of the dummy textField to some dummy UIView instead.
Hopefully this should get you somewhere!