Modal view

I have a problem with some of my views, here is a brief description of my installation:

Tab Bar Controller | --View Controller 1 | --View Controller 2 | --View Controller 2 

With a certain action, View Controller 1 displays a modal dialog. In this dialog, if the user performs another action, another modal dialog is displayed using the first modal dialog to represent the view.

In the second ModalDialog, I have a UITextField, however, when I try to enter text in a text box, nothing happens. Even if the keyboard is displayed and the textFieldDidBeginEditing method is called. I installed UITextFieldDelegate and independent respondents, but to no avail.

Does anyone know what might cause this problem?

Thank you very much

+4
source share
4 answers

I found that in a number of cases with changing perceptions and with popovers, that the text fields are not focused correctly with the symptoms, as you describe. In these cases, I end up deferring the call to becomeFirstResponder until the animation is finished or the view is loaded - for example, in the view manager's viewDidAppear .

Or simply delay the call to becomeFirstResponder with the appropriate year of the time it will take to view in order to change / animate / etc., for example:

 [textField performSelector:@selector(becomeFirstResponder) withObject:nil afterDelay:0.3]; 
+3
source

I would try to “associate” modal dialogs with the view controller, if possible.

  • VC opens the first modal dialogue
  • Your first modal dialog notifies VC (possibly through delegation).
  • (May be required) Close 1st modal dialog
  • VC opens a second modal dialog
  • Happiness!
+1
source

I am not sure what you mean with the "modal dialogue". I assume that you are referring to either a modally presented presentation controller with a UIModalPresentationFormSheet modal style, or using a UIPopoverController.

Here is my best guess: I'm sure your “modal dialog” captures all user interactions (by default). Therefore, when you press the first one, it captures all the input focus. When you press the second one, it captures conflicts with the previous one, and therefore the keyboard does not work.

In any case, both types of “modal dialogs” should not be stacked. Even if it can work technically, I don’t like how it forms the perspective of interaction. Instead of trying to fix the error or work around it, try rethinking your modal dialogue. You can put everything in one. For example, using the navigation controller inside this view or replacing the view or spilling its contents ... etc.

Hope this helps, Max

0
source

If I were you, I would revise the navigation hierarchy. Modal dialogs are considered to be bad enough as they are, but including a modal dialog in a modal dialog is a suicide user interface. This causes confusion for the user and is very unconventional. Is there a way to use the first modal popup and just share content?

Note: you mentioned the view setting as UITextViewDelegate . Have you seen the delegate for the text box? Are you returning NO or FALSE from - (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string ?

0
source

All Articles