stop popoverViewController resignFirstResponder after dismissed - ios

I am using a uitableview containing multiple rows, and each row contains two UITextFields side by side. let's say TextField1, TextField2. When a user taped on TextField1, and start typing, a popoverViewController shows up for suggestions. When the user tap on a suggestion from the popoverViewController, the popover dismissed (this is what i want), then the keyboard dismissed as well (this is not what i want). if now the user tap on TextField2, the keyboard comes up.
I want to keep the keyboard up because the user needs to input in TextField2.
How can i make this happen?
really appreciated.

Related

switching between different inputViews for the same textfields

In my app, I have a textfield that takes its input from a picker view. However, the user could not find his preferred option so I added above the textfield a small button resembling a keyboard. Once the button is pressed the textfield's picker view should disappear and the keyboard should appear instead so that the user enter his preferred data. So how can I do that? I tried resigning it as first responder and then making it become the first responder hoping the picker could be released as the input view but it didn't work. Adding a textfield as an accessory input view will not look right (having two textfield the user should update the first one instead).

Dismissing UIActionSheet on iPad without animation

I have a horizontally scrolling UITableView on the bottom of my iPad app, and when the user taps on one of the cells, I pop up a UIActionSheet from it allowing them to select between two options.
That part works fine, but I'm running into two UI problems when dismissing the actionsheet.
1) When the user clicks outside of the UIActionSheet and not a different UITableViewCell, I'd like to deselect that cell immediately and then dismiss the UIActionSheet, or fade them both out at the same time. However, when I implement
(void)actionSheet:(UIActionSheet *)actionSheet willDismissWithButtonIndex:(NSInteger)buttonIndex
to do this, it still results in the actionsheet slowly fading out before deselecting the cell, which just looks a little odd. It happens whether I'm calling [self.tableView deselectRowAtIndexPath:self.tableView.indexPathForSelectedRow animated:NO], by getting that cell and changing the appearance manually, or reloading the table. Even if I maintain a reference to the UIActionSheet from when I create it (e.g. self.actionSheet) and set it to hidden or nil when willDismissWithButtonIndex is called, it still operates this way.
2) If the user clicks outside the UIActionSheet but selects another TableViewCell, I'd like to instantly shift the UIActionSheet to the other cell. Right now, however, it just fades out slowly and then the user has to tap the new cell again in order to bring up the UIActionSheet for that cell.
Anyone have suggestions or experience with this issue?
All the best,
Toby
From the UIActionSheet class reference:
For applications running on iPad devices, the action sheet is typically displayed in a popover that is anchored to the starting view in an appropriate way. Taps outside of the popover automatically dismiss the action sheet, as do taps within any custom buttons. You can also dismiss it programmatically.
So I do not think you can change the behaviour of this UIActionSheet when user taps outside to select another cell in your app. You might want to just create your custom pop over view to address your two issues.

Different popover for editing and non editing text field

Ok, sorry if the title is a little off. Hope I explain it better here. What I want to do is have a popover (iPad app) that will do different things based on the state of a UITextField. So if the user is typing in that text field and then taps the popover button, the popover appears and if the user taps something in that popover it will get added to that text field (think something like adding often used text). In this situation the popover will only disappear when the text field finishes editing.
However if the user taps the popover button when the text field is not editing then that list of items still appears but now it should disappear if the user taps outside the popover.
I hear something about pass-through views, but I'm not certain that is what I need.
Does anybody know a good way to do this?
The passthrought views are views outside the popover that don't cause it to dismiss automatically. When you want to dismiss the popover from your code when the textfield has finished editing call [myPopover dismissPopoverAnimated:YES].
For adding text blocks into the textfield I think delegation is the right thing to do. You set the your main view as the delegate of the conten view of the popover and each time a text block in the popover is selected you tell the delegate to add this block to the textfields text.
When you want to prevent the popover from dismissing while the textfield is being edited you should implement the UIPopoverControllerDelegate methode popoverControllerShouldDismissPopover:.

How to display virtual keyboard in ios6 Simulator

How do you display the virtual keyboard in ios6 Simulator (iphone or iPad) ? I've tried the toggle keyboard option, but nothing appears, can you only make it appear with code? and if so, how?
Thanks for any advice.
You can't show the keyboard without a 'target'. The system needs to know where it should send the entered text to.
So if you have a subclass of UIView that accepts text input (UITextField for example), the keyboard is either shown when the user taps that view or you can programmatically trigger it by calling:
[textField becomeFirstResponder];
From iOS-Documentation Managing the Keyboard:
Displaying the Keyboard
When the user taps a view, the system automatically designates that view as the first responder. When this happens to a view that contains editable text, the view initiates an editing session for that text. At the beginning of that editing session, the view asks the system to display the keyboard, if it is not already visible. If the keyboard is already visible, the change in first responder causes text input from the keyboard to be redirected to the newly tapped view.
Because the keyboard is displayed automatically when a view becomes the first responder, you often do not need to do anything to display it. However, you can programmatically display the keyboard for an editable text view by calling that view’s becomeFirstResponder method. Calling this method makes the target view the first responder and begins the editing process just as if the user had tapped on the view.
If your application manages several text-based views on a single screen, it is a good idea to track which view is currently the first responder so that you can dismiss the keyboard later.

How to send open uikeyboard back while opening other subview?

In my application I have one uiview.
I am adding another subview to this view which contains one textfield.
when user clicks that field then it display the keypad.
This subview also contains one add and delete button.
when user clicks on that button another view is opened which is also the subview of main view and that view contains selection list in the table.
The problem here is when user types something in textfield so keyboard is open.
if user does not dismiss that keyboard and clicks on add button to select from selection list then only half of the selection list is visible because keyboard is still open.
I want to send the keyboard back.
Here i do not want to dismiss the keyborad.while user clicks the add button.i only want to send it back to the selection view.when user is done with selection view keyboard should be open as it is.How can i solve this issue?
If you want the keyboard to go away, you need to dismiss it when they click on the button by using [yourTextField resignFirstResponder];.
If you want it to come back when they select an item, you will need to call [yourTextField becomeFirstResponder];.

Resources