iPhone keyboard is not showing up - iphone

My app starts on login screen. After that I use the next code to call the TabBarViewController
DMMainScreenViewController *mainScreenController = [[[DMMainScreenViewController alloc] initWithNibName:#"DMMainScreenViewController" bundle:nil] autorelease];
self.view.window.rootViewController = mainScreenController;
[self.view.window makeKeyAndVisible];
and then I move to the last tab by clicking on that.
There are 2 UITextField and one UITextView and then when I touch any of them the keyboard is not showing up and I can not also change to another TextField/TextView but I can move to another tab.
How can I fix that?
Thanks.

keyboard to show up immediately you'll need to set the text field as the first responder using the following line:
[textField becomeFirstResponder];
but in these case of tabbarViewController, as tonklon says in his answer:
If the tabbar is needed while the keyboard is visible you could only
move the tabbar above the keyboard, or resize the tabbarcontroller, so
that the tabbar remains visible.
Are you sure you need the tabbar while the keyboard is visible?
Remember a tabbar is for changing the view. Perhaps you need to
rethink your interaction design.

Are you using IB to create your views? If so, did you remember to wire up your UITextField to the File's owner so that view knows where to send the notifications that you clicked on your TextField?

Related

resignFirstResponder Leaves Keyboard Behind

iPhone app.
I have a simple view with UITextView as first responder. I resign first responder and pop to the previous controller but the keyboard stays. Textview doesn't even exist anymore but the keyboard is still visible.
The controller that I pop to is a tableview, no objects that can even assume first responder status. So the keyboard is just there obscuring half my table and there is not even a way to dismiss it. I have to navigate back to a view that has a text box or textview, select one and dismiss that in order to get rid of the keyboard.
How is this possible?
On viewWillAppear just write
[self.view endEditing:YES];

Touch Focus Changing After Showing DatePicker In a Popup

I have a UIViewController. In my view (xib), I have a UIButton and a UIToolBar. On "Touch Up Inside", I have the following:
UINavigationController *nc = [[UINavigationController alloc] initWithRootViewController:ec];
nc.modalPresentationStyle = UIModalPresentationFormSheet;
[self presentModalViewController:nc animated:YES];
"ec" is a UITableViewController. For this view (xib), I have three rows that consists of three text fields. In one text field, I'm setting the "inputView" to a UIDatePicker. If I put focus on this text field the datepicker shows up as it suppose to. When I set the focus on another text field, the keyboard shows up. But when I close the popup, it seems like the UIButton and UIToolBar right navigation button isn't working. Actually it is, but I have to click about an inch above the control to trigger the popup again. What gives?!
Sorry for the late post but found out the application was recalculating the view coordinates which threw it off. After fixing this, all is good.

Hiding ToolBar in a UIViewController

I have a UIViewCOntroller, and in that i have a button and a text field. When i click the button i display a UIToolBar.
Now when i click anything in the background (the textfield or the blank view) i need this UIToolBar to disappear. How can i do this programmatically ?
I know how to add a UIToolBar but all what i need to know is to hide it when the user clicks on the background.
I don't think i will have to paste any code here or show my workings so far, coz i have no clue how to get this done
- (void)viewWillAppear:(BOOL)animated{
[super viewWillAppear:animated];
[self.navigationController setToolbarHidden:YES animated:YES];
}
May be it can help you....
You will need to capture a touch on the views outside of your toolbar to achieve this. If you have a custom UIView base class that all of your other views use, you might start there. Otherwise, perhaps use some sort of toggle to show/hide your toolbar instead in your UIViewController.
The easiest way to do this is to make a single large clear button that is behind the first button but above everything else. Normally have it set to hidden but when you show the toolbar unhide the button as well. When the button is clicked have it hide the toolbar and its self. No need to do anything crazy like sub classes.

Static keyboard in uitableview

I have a UITableView that holds just two cells with a textfield in each. As my tableview is just for editing the text in these textfields I always want the keyboard to be shown static in the bottom of the screen. So in viewDidLoad I set the first textfield to become first responder.
Something I have noticed though is that when I push the UITableViewController into the UINavigationController the keyboard show up a little bit slower so you can see it animate into the screen. It would be much better if it was there already there when the uitableview shows up.
I also tried making the textfield first responder before pushing it as recommended but that didn't made the keyboard show at all:
MyTableViewController *myTableViewController = [[MyTableViewController alloc] initWithNibName:#"MyTableViewController" bundle:nil];
[myTableViewController.textField becomeFirstResponder];
[self.navigationController pushViewController:myTableViewController animated:YES];
[myTableViewController release];
How can I accomplish this?
Thanks!
take the textfield as public(set its property and synthesis) and from the place you are pushing it before that push set the first textfields to become first responder...
and then push to the controller...
There can be much more options but this is the one i can suggest... may be it help...
Happy Coding....

Hiding UITabBar when displaying UIPickerView in iPhone SDK

I've got a view when I want to use UIPickerView but my application supports also UITabBar. I want to display UIPickerView in the same spot where keyboard pops up but the problem is that when I do that tab bar buttons are above picker and only half of it is beign displayed. Is is possible to temporary disable tab bar before I draw a picker and restore it when picker will disappear?
Can you show us how you're displaying the UIPickerView? I'll assume you're adding it as a subview to a view controller that is shown from a tab bar, and setting its frame so that it is positioned the same as the keyboard.
In that case, try adding the UIPickerView as a subview to the window, rather than the view controller's view:
[[[UIApplication sharedApplication] keyWindow] addSubview:myPickerView];
This should show it above all other views.
One likely caveat is that if a keyboard needs to be shown at any time while your pickerview is in place, the keyboard will show above your pickerview, hiding it until the keyboard is dismissed again.
What if you called
myTabBarController.tabBar.hidden = YES;
before showing this picker view?