编辑UITableViewCell中的UITextField失败 [英] Editing a UITextField inside a UITableViewCell fails

查看:101
本文介绍了编辑UITableViewCell中的UITextField失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的应用程序中,我在 UITableViewCell 中有一个 UITextField 。如果我单击文本字段内部并添加一些文本,我发现如果尝试移动插入点,它工作的第一次,但在随后的尝试失败。我完全不能移动选择;没有放大镜出现。

In my application I have a UITextField inside a UITableViewCell. If I click inside the text field and add some text I find that if try to move the insertion point it works the first time but fails on subsequent attempts. I am completely unable to move the selection; no "magnifying glass" appears.

更奇怪的是,这个设置似乎是永久的,直到我重新启动应用程序。它会影响该屏幕上的所有 UITextFields ,而不仅仅是我最初尝试编辑的那个。

Even more curious, this "setting" seems to be permanent until I restart the application. And it affects all UITextFields on that screen and not just the one that I originally tried to edit.

想自己看看,试试iPhone SDK附带的UICatalog示例。点击文本字段,然后编辑,并在文本框中玩。

If you want to see it yourself, try the "UICatalog" sample that comes with the iPhone SDK. Click "text fields" and then "edit" and play around with the text boxes.

我做了很多挖掘,但很难谷歌!我找到的最好的参考资料是 Apple的支持板 MacRumors formum (两个参考一个解决方案,显然用于工作在iPhone 2.0,但不工作与现代版本 - 我没有尝试)。

I've done a lot of digging on this but it's pretty hard to Google for! The best references I've found are on Apple's support board and MacRumors formum (both reference a solution that apparently used to work on iPhone 2.0 but does work not with contemporary versions -- I did try).

我的感觉是这是一个在操作系统的错误,但我认为我会抛弃这一点群众的第二意见,并看看是否有任何解决方法。任何想法?

My feeling that is that this is a bug in the OS, but I thought I'd throw this out to the SO crowd for a second opinion and to see if there are any workarounds. Any ideas?

根据benzado的建议,我尝试使用2.0,2.1和2.2 SDK构建我的应用程序。我在所有版本中有相同的行为。 (实际上,一些相关的但不是相同的破裂在2.2,但这可能是另一个问题!)

Following benzado's suggestion, I tried building my application using the 2.0, 2.1 and 2.2 SDKs. I got the same behaviour in all versions. (Actually, something related but not the same broke in 2.2 but that's probably another question!)

推荐答案

我花了很多时间

诀窍在于,表需要是可编辑的(即它的编辑

The trick is that the table needs to be editable (i.e., its editing property needs to be set to YES). The good news is that you are now able to move the insertion point. Sometimes the magnifying glass doesn't appear or follow but your gesture always seems to work.

这仍然是一个错误?也许。至少苹果的SDK文档应该更新。我已经提出一个bug报告苹果覆盖这一点(rdar:// 6462725)。

Does this still qualify as a bug? Perhaps. At the very least Apple's SDK documentation should be updated. I've raised a bug report with Apple to cover this (rdar://6462725).

这篇关于编辑UITableViewCell中的UITextField失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆