2

I am presenting a UIViewController as a modal viewcontroller with modalPresentationStyle = UIModalPresentationFormSheet. I have few UITextFields on its view.

My issue is that when I try to dismiss the keyboard ([textfieldname resignFirstResponder]), it doesn't do anything. However when I change the modalPresentationStyle to UIModalPresentationPageSheet, it works.

This seems to be a bug. Has any one faced similar problems and found a work around? Could I be doing anything dumb and silly?

bibhas
  • 77
  • 1
  • 7

1 Answers1

1

I ran into this same issue with UITextView, I ended up subclassing UITextView and overriding resignFirstResponder as follows...

- (BOOL)resignFirstResponder{
    [super resignFirstResponder];
    // For some reason, UITextView doesn't like to give up first responder, ever....
    return YES;
}

I haven't checked if this is still necessary in 4.3 but it was definitely needed in 3.2 in some cases.

Cory Powers
  • 1,140
  • 8
  • 14