MFMessageComposeViewController后没有显示键盘(Keyboard not showing after MFMessageComposeViewController)

在iPhone应用程序中,我有一个UITextView和一个按钮,它允许用户将UITextView的内容作为文本消息发送。 代码如下所示:

MFMessageComposeViewController *picker = [[MFMessageComposeViewController alloc] init];
picker.messageComposeDelegate = self;

picker.body = textView.text;

[self presentModalViewController:picker animated:YES];

一切工作正常,除了消息发送时或在MFMessageComposer点击Cancel时: 即使光标闪烁, UITextView的键盘也不再显示

我尝试了一些东西,包括按钮代码和-viewDidDisappear[textView resignFirstRepsonder]MFMessageComposeViewControllerDelegate方法中的[textView becomeFirstResponder]-viewDidAppear不会更改任何内容...

有任何想法吗?


In an iPhone app I have a UITextView and a button, which lets the user send the content of the UITextView as a text message. The code looks like this:

MFMessageComposeViewController *picker = [[MFMessageComposeViewController alloc] init];
picker.messageComposeDelegate = self;

picker.body = textView.text;

[self presentModalViewController:picker animated:YES];

Everything works fine, except for when the message is either sent or Cancel is tapped in the MFMessageComposer: The keyboard for the UITextView is not shown anymore, even though the cursor blinks.

I tried a few things, including a [textView resignFirstRepsonder] in both the button code and -viewDidDisappear. [textView becomeFirstResponder] in the MFMessageComposeViewControllerDelegate method or the -viewDidAppear didn't change anything either...

Any ideas?


原文:https://stackoverflow.com/questions/4768425
2021-08-16 20:08

满意答案

首先想到的是我注意到标签标签没有关闭“>”。 它不在HTML代码中,但表单标签的ID是否为“form”?

两行var $ answer ...和var answer ...可以合并为

var answer = $('#unit_name').val();

最后,在你的html代码中,你有一个id =“result”的div(或其他标签)吗? 如果是这样,它隐藏了吗? 如果它是隐藏的,设置完信息后,您需要取消隐藏。


First think I noticed is that the label tag doesn't have a closing ">". It isn't in the HTML code, but does the form tag have an id of "form"?

The two lines var $answer... and var answer... could be combined to

var answer = $('#unit_name').val();

Lastly, in your html code, do you have a div (or other tag) with an id="result"? If so, is it hidden? If it is hidden, after setting your message, you will need to un-hide it.

相关问答

更多

如何清除jQuery验证错误消息?(How to clear jQuery validation error messages?)

你想要resetForm()方法: var validator = $("#myform").validate( ... ... ); $(".cancel").click(function() { validator.resetForm(); }); 我从他们的一个演示的来源抓住了它。 注意:此代码将不适用于Bootstrap 3。 You want the resetForm() method: var validator = $("#myform").validate...

jquery验证错误消息不隐藏,为什么(Jquery validation error messages are not hiding, why)

如果要隐藏验证错误消息,则应该使用resetForm函数而不是hideErrors函数。 正如在他们的回答中提到的, resetForm在内部调用hideErrors函数。 但是,这里有一个转折点 ,当你尝试使用resetForm函数时,它不会工作,因为jquery.validate.unobtrusive插件的工作方式。 jquery.validate.unobtrusive插件覆盖jquery.validate插件的errorClass和errorElement属性。 从jquery.vali...

JQuery自定义验证错误(JQuery custom validation error)

看看这个,找不到验证器,因为它正在查看$()内部。 你需要使用$.validator.addMeth....它进入默认的jquery对象。 喜欢这个: $.validator.addMethod("defaultInvalid", function(value, element) { alert("validate"); }); 或者用于访问Jquery对象的任何内容 JQuery.validator.addMethod("defaultInvalid", func...

更改jquery验证错误消息(Changing jquery validation error message)

rules ,请执行: messages: { checkboxes: { minlength: 'Please check at least 3 boxes.' } } After your rules, do: messages: { checkboxes: { minlength: 'Please check at least 3 boxes.' } }

我的JQuery验证错误(Error in my JQuery validation)

首先想到的是我注意到标签标签没有关闭“>”。 它不在HTML代码中,但表单标签的ID是否为“form”? 两行var $ answer ...和var answer ...可以合并为 var answer = $('#unit_name').val(); 最后,在你的html代码中,你有一个id =“result”的div(或其他标签)吗? 如果是这样,它隐藏了吗? 如果它是隐藏的,设置完信息后,您需要取消隐藏。 First think I noticed is that the label t...

文本框上的JQuery验证错误(JQuery Validation Error on textbox)

此问题是由我正在使用的JQuery Validation插件引起的。 我使用Nuget更新到最新的JQuery Validation Plugin(1.11),现在一切正常。 希望这对将来有所帮助。 This problem was caused by the JQuery Validation plugin that I was using. I updated to the newest JQuery Validation Plugin (1.11) using Nuget and every...

jquery在验证错误后触发(jquery triggered after validation error)

您需要在文档加载中添加检查子句以显示隐藏的输入字段 $(document).ready(function () { // Show the input if the checkbox is checked if ($("#penerima_beda").is(":checked")) { $("#panel_penerima").css("display", "block"); $("#nama_penerima").attr("required"...

使用jquery进行验证(validation using jquery)

使用jQuery插件番茄酱,它使用少量浮动对话泡泡,因此不需要太多的空间。 Use the jQuery plug-in Ketchup it uses little floating talk bubbles so not as much space is needed.

jQuery验证 - 语法错误(jQuery validation - syntax error)

解 您的错误是您将函数传递给validate : $("#testform").validate(function() { // <-- here you're passing a function // ... }) 其中validate需要一个对象: $("#testform").validate({ // <-- but you should pass an object // ... }); 语法错误是在函数表达式上声明对象属性的结果。 $("#testform").valid...

jQuery验证错误消息位置(jQuery validation error message location)

错误消息“元素”的唯一原因是因为两者都是内联元素( <select>和<label> )。 您可以通过简单地移动下面的错误消息: 1)使用一些CSS来定位错误标签,使其display: block; 要么 2)在插入之前将错误标签包装在某个块元素中(您可以使用上面发布的代码并在附加之前将错误包装在div中) The only reason the error message is "next" to the element is because both are inline elements (...

相关文章

更多

Android EditText软键盘显示隐藏以及“监听”

一、写此文章的起因 本人在做类似于微信、易信等这样的聊天软件时,遇到了一个问题。聊天界面最下面一般类似 ...

登录界面与Android软键盘显示、隐藏的交互设计

在我们的Android应用中最常与Android的软键盘打交道的要属登录界面了,下面是本人感觉比较好的 ...

用C#捕捉键盘和鼠标

用C#捕捉键盘和鼠标 直接把下面代码copy到VS05编译器中运行. using System ; ...

关于jsp中的分页显示问题

用netbeans做再线考试,在页面显示时,想将DEBY数据库中的考题分页显示

在线文档显示打印

哪位见过这种类型的在线文档显示打印,是用什么插件做的 问题补充:j2ee中有没有类似的插件

dreamweaver 8 与 ie 7 的显示的效果不同?

我用的Dreamweaver8编辑页面时,显示的效果很好,但用ie7打开时,页面让人很是受不了?? ...

freemarker的时间显示如何处理啊

我对freemarker不熟悉 我的工程:struts2+spring+hiberante+free ...

EditorGridPanel中ComboBox显示问题?

function getConsumerUnit(value){ var rd = houFct.Em ...

js页面显示广告

各位大虾好,小弟最近有一个想法,就是在自己的网页插入一段广告。具体的效果和ku6等网站类似,在下载页面 ...

Obama says economy moving in right direction

President Barack Obama talks about the latest repor ...

最新问答

更多

获取MVC 4使用的DisplayMode后缀(Get the DisplayMode Suffix being used by MVC 4)

我用Google搜索了一个解决方案。 “EnumDisplayModeProvider”是我自己设置网站的各种模式的枚举。 public EnumDisplayModeProvider GetDisplayModeId() { foreach (var mode in DisplayModeProvider.Instance.Modes) if (mode.CanHandleContext(HttpContext)) {

如何通过引用返回对象?(How is returning an object by reference possible?)

这相对简单:在类的构造函数中,您可以分配内存,例如使用new 。 如果你制作一个对象的副本,你不是每次都分配新的内存,而是只复制指向原始内存块的指针,同时递增一个也存储在内存中的引用计数器,使得每个副本都是对象可以访问它。 如果引用计数降至零,则销毁对象将减少引用计数并仅释放分配的内存。 您只需要一个自定义复制构造函数和赋值运算符。 这基本上是共享指针的工作方式。 This is relatively easy: In the class' constructor, you allocate m

矩阵如何存储在内存中?(How are matrices stored in memory?)

正如它在“熵编码”中所说的那样,使用Z字形图案,与RLE一起使用,在许多情况下,RLE已经减小了尺寸。 但是,据我所知,DCT本身并没有给出稀疏矩阵。 但它通常会增强矩阵的熵。 这是compressen变得有损的点:输入矩阵用DCT传输,然后量化量化然后使用霍夫曼编码。 As it says in "Entropy coding" a zig-zag pattern is used, together with RLE which will already reduce size for man

每个请求的Java新会话?(Java New Session For Each Request?)

你是如何进行重定向的? 您是否事先调用了HttpServletResponse.encodeRedirectURL()? 在这里阅读javadoc 您可以使用它像response.sendRedirect(response.encodeRedirectURL(path)); The issue was with the path in the JSESSIONID cookie. I still can't figure out why it was being set to the tomca

css:浮动div中重叠的标题h1(css: overlapping headlines h1 in floated divs)

我认为word-break ,如果你想在一个单词中打破行,你可以指定它,这样做可以解决问题: .column { word-break:break-all; } jsFiddle演示。 您可以在此处阅读有关word-break属性的更多信息。 I think word-break, with which you can specify if you want to break line within a word, will do the trick: .column { word-break

无论图像如何,Caffe预测同一类(Caffe predicts same class regardless of image)

我认为您忘记在分类时间内缩放输入图像,如train_test.prototxt文件的第11行所示。 您可能应该在C ++代码中的某个位置乘以该因子,或者使用Caffe图层来缩放输入(请查看ELTWISE或POWER图层)。 编辑: 在评论中进行了一次对话之后,结果发现在classification.cpp文件中错误地删除了图像均值,而在原始训练/测试管道中没有减去图像均值。 I think you have forgotten to scale the input image during cl

xcode语法颜色编码解释?(xcode syntax color coding explained?)

转到: Xcode => Preferences => Fonts & Colors 您将看到每个语法高亮颜色旁边都有一个简短的解释。 Go to: Xcode => Preferences => Fonts & Colors You'll see that each syntax highlighting colour has a brief explanation next to it.

在Access 2010 Runtime中使用Office 2000校对工具(Use Office 2000 proofing tools in Access 2010 Runtime)

你考虑过第三方拼写检查吗? 您可以将在C#中开发的自定义WinForms控件插入访问数据库吗? VB6控件怎么样? 如果你能找到一个使用第三方库进行拼写检查的控件,那可能会有效。 Have you considered a third party spell checker? Can you insert a custom WinForms controls developed in C# into an access database? What about a VB6 control? If

从单独的Web主机将图像传输到服务器上(Getting images onto server from separate web host)

我有同样的问题,因为我在远程服务器上有两个图像,我需要在每天的预定义时间复制到我的本地服务器,这是我能够提出的代码... try { if(@copy('url/to/source/image.ext', 'local/absolute/path/on/server/' . date("d-m-Y") . ".gif")) { } else { $errors = error_get_last(); throw new Exception($err

从旧版本复制文件并保留它们(旧/新版本)(Copy a file from old revision and keep both of them (old / new revision))

我不确定我完全明白你在说什么。 你能编辑你的帖子并包含你正在做的Subversion命令/操作的特定顺序吗? 最好使用命令行svn客户端,以便容易为其他人重现问题。 如果您只是想获取文件的旧副本(即使该文件不再存在),您可以使用如下命令: svn copy ${repo}/trunk/moduleA/file1@${rev} ${repo}/trunk/moduleB/file1 其中${repo}是您的存储库的URL, ${rev}是您想要的文件的版本。 这将恢复该文件的旧版本,包括最高版本