如何实现像 iPhone 上的电子邮件地址那样的自动选择文本框?

发布于 2024-07-15 03:54:02 字数 157 浏览 3 评论 0原文

在 iPhone 的邮件应用程序上,您可以输入多个邮件地址...然后要删除一个,只需点击它,然后单击“删除”。我如何在我的应用程序中实现类似的功能? 我尝试处理 UITextView 上的点击,但看起来此类及其子类没有触发 TouchBegan 和相关委托方法:(

有什么想法吗?

On the iPhone's mail app, you can type in multiple mail addresses...and then to delete one you just tap it, and click Del. How can I implement something similar in my app? I tried to handle the tap on a UITextView, but it looks like the touchesBegan and related delegate methods are not fired for this class and its subclasses :(

Any idea?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

叹沉浮 2024-07-22 03:54:03

这可能会有所帮助:链接

TITokenFieldView
模仿邮件和消息中“收件人:”字段的控件。 有点像 NSTokenField。

This could be helpful: Link

TITokenFieldView
A control which mimics the To: field in Mail and Messages. Kinda like an NSTokenField.

请远离我 2024-07-22 03:54:02

我实现了一个与 mail.app 中的视图相同的视图。 我使用了一个由自定义 UIView 组成的复合视图,其中包含一些其他类型的视图。 我使用 UITextField 来输入文本。 当用户完成地址时,我将文本放置在带有自定义背景图像的按钮中(以获得文本周围的气泡外观),并将 UITextField 移至右侧(或视情况移至下一行) 。 当用户点击地址“气泡”之一时,它就会被选中。 如果他们按下删除键,我会从视图中删除该气泡并重新布局所有内容。 这是一个使用许多有趣的边缘情况构建的不平凡的视图。

I have implemented a view that is identical to what is found in the mail.app. I used a composite view comprised of a custom UIView which houses a couple of other types of views. I used a UITextField for the text entry. As the user completes an address I take the text and place it in a button with a custom background image (to get the bubble around the text look) and move the UITextField to the right (or to the next line as the case may be). When the user taps one of the address "bubbles" it is selected. If they hit the delete key I remove that bubble from the view and re-layout everything. This is a non-trivial view to build with lots of fun edge cases.

℡寂寞咖啡 2024-07-22 03:54:02

查看 Joe Hewitt Three20 项目,它包括可以做这样的事情的“更好的文本字段”。

Check out Joe Hewitt three20 project, it includes "Better text fields" which can do such thing.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文