相当于iOS中的Android TextView? [英] What is the equivalent of Android TextView in iOS?

查看:55
本文介绍了相当于iOS中的Android TextView?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我在Google和StackOverflow中搜索相当于iOS的Android TextView"时,我希望能找到一个快速的答案,但是它花了一些时间来搜索和切换关键字.我正在发布此问答集,以便其他人可以快速找到这些关键字.

When I searched for "Android TextView equivalent in iOS" in Google and StackOverflow I expected to find a quick answer but it took a little searching and switching up of keywords. I am posting this Q&A pair so that other people can have the quick answer for these keywords.

我从事Android编程已有大约一年的时间,现在我开始使用iOS.我一直在做的所有教程都使用 UILabel 来显示文本,但是我希望多行文本可能长一些段落,而UILabel似乎不适合该文本.

I've been doing Android programming for about a year and now I am starting on iOS. All of the tutorials I've been doing use UILabel to display text but I want multiline text that could be paragraphs long and UILabel doesn't seem suited to that.

这个问题出现了,但这是错误的方向(iOS到Android)

This one came up, but that was the wrong direction (iOS to Android):

iOS到Android:如何显示TextView

还有其他一些等效"问题,但不是我想要的:

And here are some other "equivalent" questions but not the one I wanted:

推荐答案

iOS中与Android TextView 等效的是 UILabel UITextView .您想要大量文本的是 UITextView .以下是对文档的说明:

The equivalent of an Android TextView in iOS is UILabel and UITextView. The one you want for large amounts of text is UITextView. Below are descriptions taken from the documentation:

UITextView

UITextView类实现了可滚动的行为,多行文字区域.该类支持使用来显示文本自定义样式信息,还支持文本编辑.你通常使用文本视图显示多行文本,例如显示大文本文档的正文.

The UITextView class implements the behavior for a scrollable, multiline text region. The class supports the display of text using custom style information and also supports text editing. You typically use a text view to display multiple lines of text, such as when displaying the body of a large text document.

UILabel

UILabel类实现了只读文本视图.你可以用这个类以绘制一行或多行静态文本,例如您可能会用来识别用户界面的其他部分.

The UILabel class implements a read-only text view. You can use this class to draw one or multiple lines of static text, such as those you might use to identify other parts of your user interface.

UITextField

UITextField对象是显示可编辑文本和当用户按下时,将操作消息发送到目标对象返回按钮.您通常使用此类收集少量来自用户的文本并立即执行一些操作,例如搜索操作,基于该文本.

A UITextField object is a control that displays editable text and sends an action message to a target object when the user presses the return button. You typically use this class to gather small amounts of text from the user and perform some immediate action, such as a search operation, based on that text.

以下是一些进一步研究的链接:

Here are some links for further research:

  • Using Text Kit to Draw and Manage Text (documentation)
  • Text Kit Tutorial in Swift
  • Using Text Kit to Manage Text in Your iOS Apps
  • ios: best way to display variable-length, multi-line text

这篇关于相当于iOS中的Android TextView?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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