Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
有没有办法从 MFMailComposeViewController 关闭键盘?如果用户旋转设备,我将加载一个单独的控制器而没有按下“发送”或“取消”,并且键盘仍保留在屏幕上。有没有办法在不按下“完成”或“发送”的情况下关闭键盘?
您可以找到第一响应者并要求它退出活动,这应该关闭键盘。
UIWindow* keyWindow = [[UIApplication sharedApplication] keyWindow]; UIView* firstResponder = [keyWindow performSelector:@selector(firstResponder)]; [firstResponder resignFirstResponder];