如何同时显示两个滚动 TextView
我想在屏幕上显示两个窗口,其中包含滚动文本,例如顶部窗口将有一个圣经翻译,而底部视图将有另一个。
理想情况下,我希望它们保持同步,以便它们在各自的翻译中显示相同的点(即在顶视图中切换到 John Ch1,底视图跟随并执行相同的操作)。但现在我只是好奇如何将它们放入两个单独的可视窗口中。
有什么想法吗?
I'd like to display two windows on screen with scrolling text in them e.g. top window will have one bible translation while the bottom view would have another.
Ideally, I'd like them to stay in sync so they're both showing the same point in their respective translations (i.e. switch to John Ch1 in top view, bottom view follows and does same). But for now I'm just curious how to get these into two seperate viewable windows.
Any ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
老实说,我认为 iPhone 没有足够的屏幕空间以用户视觉上舒适的方式执行此操作。
除此之外,最好的方法将取决于应用程序其余部分的构建方式。您可以创建一个包含两个 UITextView 的视图,每个视图大约占据屏幕的一半。您应该能够滚动一个滚动作为对另一个滚动的响应,尽管我还没有这样做,所以我无法告诉您到底如何做。
您的另一个选择是使用主 UITextView,然后使用覆盖在其上方的第二个 UIModalView。这一切都取决于应用程序的结构。
请注意,除非您有特定的翻译点标记,否则很难让它们以这种方式同步。您可以尝试匹配行号或类似的内容,但由于语言差异很大,可能需要 3 行,而翻译可能需要 4 行才能表达相同的内容。
In all honesty, I dont think you have the screen space to do this for the iPhone in such a way that is visually comfortable for the user.
That aside, the best method would depend on how the rest of your app is built. You can create a view that contains two UITextViews in it, each taking up roughly half the screen. You should be able to scroll one as a response to the other scrolling, though I haven't done this, so I cannot tell you how to do it exactly.
Another option that you have is to use a main UITextView, and then a second UIModalView that is overlaid above it. It all depends on the app structure.
Just to note, unless you have specific markers for points of translation, it would be very hard to have them sync up in that way. You could try to match line numbers, or something like that, but due to languages being so different, one might take 3 lines, and a translation might take 4 to say the same thing.
这是一个相当基本的问题,所以您也许应该重新访问 iOS 应用程序编程指南,但简而言之,您将有两个 UITextView 元素在应用程序的视图内,您可以使用内置的 setter 方法在它们之间进行同步
This is a fairly basic question, so you should perhaps revisit the iOS Application Programming Guide, but in a nutshell, you'd have two UITextView elements inside a view in your application, and you can synchronize between them using the built in setter method
这里您有两个需求:
(1) 您需要创建一个数据模型,可以保存翻译并将每个翻译中的每个章节和诗节链接到所有其他翻译中的章节和诗节。为此,我建议学习 Core Data。准备好花一些时间学习它。
(2) 您需要显示翻译。为此,我建议您在同一包含视图中使用两个 UITextView。然而,正如 Karoly S 指出的那样,iPhone 屏幕上确实没有空间容纳两个文本视图。我建议使用通过 翻转过渡,这将允许您在全屏上进行一次翻译,然后翻到另一个翻译。用户可以快速来回翻页进行比较。
You have two needs here:
(1) You need to create a data model that can hold the translations and link each chapter and verse in each translation to the chapter and verse in all the other translations. For that, I would suggest learning Core Data. Be prepared to spend some time learning it.
(2) You need to display the translations. For this I would suggest you use two UITextViews in the same containing view. However, as Karoly S noted, there really isn't room on an iphone screen for two text views. I would recommend using two views connect by a flip transition which will allow you to have one translation on a full screen and then flip over to the other translation. The user could flip rapidly back and forth to compare.