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.
Related
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?
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.
I have a bit of complex issue with a UITabBarItem it's UIViewController. Basically I have a series of UIButtons which is a layer on top of UITabBar, if the a UIButton is selected the right UITabBarItem is selected.
The complex issue starts when I have a UIViewController that is displayed when one of the UITabBarItem is pressed this takes the whole screen and displays a series of UIButtons. Once you press a button it returns back to the UITabBarItem selected but what I want in the UIViewcontroller is to have a dynamic UIView. I can get everything else working except that because the viewDidLoad is pre-loaded within that view.
Any suggestions. Sorry if that was a mouthful!
Now that I understand what you are asking, it seems that you need the view within the fifth tab to change based on what button is pressed - you can achieve this by making a bunch of graphic buttons to fill the view, then to have the fullscreen overlay you need to have your view present the new view as a modal view controller.
[self presentModalViewController:controllerForButton1 animated:NO]
This actually doesn't have much to with tab bars, this just happens to be within a tab bar controller, and they used the fifth view to hold a big menu, because there weren't enough tabs to suit their need.
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....
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?