在viewWillDisAppear:或其他离开时调用的方法中使用:[self.view endEditing:YES];
此方法的好处在于通用,不需要知道哪个view是first responder.
参考链接:http://stackoverflow.com/questions/1823317/get-the-current-first-responder-without-using-a-private-api