Get the current first responder without using a private API

前端 未结 28 1835
夕颜
夕颜 2020-11-22 05:03

I submitted my app a little over a week ago and got the dreaded rejection email today. It tells me that my app cannot be accepted because I\'m using a non-public API; specif

28条回答
  •  难免孤独
    2020-11-22 05:43

    If you just need to kill the keyboard when the user taps on a background area why not add a gesture recognizer and use it to send the [[self view] endEditing:YES] message?

    you can add the Tap gesture recogniser in the xib or storyboard file and connect it to an action,

    looks something like this then finished

    - (IBAction)displayGestureForTapRecognizer:(UITapGestureRecognizer *)recognizer{
         [[self view] endEditing:YES];
    }
    

提交回复
热议问题