简体   繁体   English

Swift中的模块化文本占位符块

[英]Modular Text Placeholder Blocks in Swift

I want the user of an App edit text with prepared modular text parts. 我希望应用程序的用户使用准备好的模块化文本部分来编辑文本。 The behaviour should be as in the mail app of iOS. 该行为应与iOS的邮件应用程序中的行为相同。 If you hit enter on the keyboard the mail adress becomes a block, which can be grabbed, moved and deleted only together. 如果您按键盘上的Enter键,则邮件地址将变成一个块,只能一起抓取,移动和删除。 You can't edit the block's inner content. 您无法编辑块的内部内容。 I only need these kind blocks to move around on a large UITextView. 我只需要这些种类的块即可在较大的UITextView上移动。

I started trying out several things: - Placed a UIView over the UITextField and by adding exclusivePaths, I managed to move the view on top of the textfield. 我开始尝试几件事:-将UIView放在UITextField上,并通过添加ExclusivePaths,我设法将视图移到了文本字段的顶部。 I don't see how I can detect the position of the view related to the text of the UITextField to insert on the right position. 我看不到如何检测与UITextField文本相关的视图的位置以插入正确的位置。 - I played around with attributed texts and text backgrounds. -我玩了归属文本和文本背景。 Looks good, but the text blocks don't stay together and I can't move them around. 看起来不错,但文本块不会在一起,我无法移动它们。

Am I on the right way or is there an easier way? 我是在正确的道路上还是有更简单的道路?

Has anyone of you worked on a similar topic? 你们中有人从事过类似的话题吗? I can't find anythings related to that. 我找不到与此有关的任何东西。 Although it is realised in the Mail App, there don't seem to be too many use cases for that? 尽管它已在Mail App中实现,但似乎没有太多用例? Any tips are welcome! 欢迎任何提示!

I've found for you some other StackOverflow answers that can lead you in the right direction: 我为您找到了其他一些StackOverflow答案,这些答案可以引导您朝正确的方向前进:

Based on these answers, I suggest you take a look at these third-party components on GitHub : 根据这些答案,建议您查看GitHub上的这些第三方组件:

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM