iOS共享扩展程序解除键盘 [英] iOS share extension dismiss keyboard
问题描述
我正在为我的应用实现共享扩展,到目前为止一切都很顺利,除非我似乎无法解除使用默认布局/故事板自动打开的键盘。
I'm implementing a share extension for my app, so far everything is going good except I can't seem to dismiss the keyboard that automatically opens using the default layout/storyboard.
我保留了包含预览图像和UITextview的默认设计/布局(SLComposeServiceViewController),UITextview自动聚焦,打开键盘。
I'm keeping the default design/layout (SLComposeServiceViewController) which includes the preview image and UITextview, the UITextview automatically gets in focus which opens the keyboard.
通常这很好,但是如果你没有登录我的应用程序,我会显示一个UIAlertController,说你需要登录才能分享。问题是键盘会在警报的同时打开。
Normally this is fine, but if you're not logged in my app I display an UIAlertController saying you need to login to share. The problem is the keyboard opens at the same time as the alert.
我试过 [self.view endEditing:YES];
和 [self.textView resignFirstResponder];
在viewDidLoad,viewDidAppear和viewWillAppear都没有运气。
I've tried [self.view endEditing:YES];
and [self.textView resignFirstResponder];
in both viewDidLoad, viewDidAppear and viewWillAppear with no luck.
推荐答案
找到答案!我没有仔细阅读文档...
Found the answer! I didn't read the docs very carefully...
我必须做 [self.textView resignFirstResponder];
in - (void)presentationAnimationDidFinish
这篇关于iOS共享扩展程序解除键盘的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!