Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个宽度为 300 像素、高度为 270 像素的 UITextField。当我想编辑它时,光标会自动移动到中间,我只能在中间一行写字。如何将此 UITextField 设置为具有几行和从左上角开始的光标?
简单的答案,只需使用UITextView。
UITextView
UITextfield 仅适用于单行,如果您想输入多行文本而不是使用 UITextView 并将其可编辑属性设置为 YES,那么它的行为就像文本字段!
[myTextView setEditable:YES];
注意:您也可以通过 Interface Builder 进行设置,选择“可编辑”框,默认为多行。