1

i have an action that allows me to present a ModalViewController and show the UITextField as a first responder, the problem is when this ModalViewController will come up it takes a little time, the cause is the keyboard, and when i grab the code to the viewDidAppear the keyboard take a little time to show up, so how can i do to make the UIViewController comes up quickly?

- (IBAction)goToModalViewController
{    
    ModalSearchViewController *msvc = [[ModalSearchViewController alloc] init];
    self.msvc.context = context;
    self.msvc.delegate = self;
    [self.msvc setModalTransitionStyle:UIModalTransitionStyleCrossDissolve ];                                                                                                                                                                                                                                                                                                                                                       
    [self presentModalViewController:msvc animated:YES];
}

The viewWillAppear of the ModalViewController:

- (void)viewWillAppear:(BOOL)animated
{
   [super viewWillAppear:YES];

   [findTextField becomeFirstResponder]; 
}
keep on you
  • 310
  • 6
  • 21

1 Answers1

1

Try like this in the viewWillAppear.

- (void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];

    //[findTextField becomeFirstResponder]; 
    [findTextField performSelector:@selector(becomeFirstResponder) withObject:nil afterDelay:0.3];
}
Ilanchezhian
  • 17,426
  • 1
  • 53
  • 55