Ios 大注释文本字段,需要换行

Ios 大注释文本字段,需要换行,ios,uitextfield,Ios,Uitextfield,我有一个宽度为280,高度为100的便笺文本字段,我只能写一行/第一行。。。 我需要为这个文本字段换行。。。我该怎么做 以下是我对文本字段的设置: _notizField.layer.cornerRadius=0.0f; _notizField.layer.masksToBounds=YES; _notizField.layer.borderColor=[UIColor colorWithRed:22/255.0f green:126/255.0f blue:25

我有一个宽度为280,高度为100的便笺文本字段,我只能写一行/第一行。。。 我需要为这个文本字段换行。。。我该怎么做

以下是我对文本字段的设置:

_notizField.layer.cornerRadius=0.0f;
        _notizField.layer.masksToBounds=YES;
        _notizField.layer.borderColor=[UIColor colorWithRed:22/255.0f green:126/255.0f blue:251/255.0f alpha:1.0f].CGColor;
        _notizField.layer.borderWidth= 1.0;
        _notizField.enabled = NO;

感谢您的帮助

UITextField
中不可能断行。有一个备用选项可以使用
UITextView
。它允许换行,也用于显示大量文本,如段落。您可以创建
UITextView
,如下所示:

UITextView *myTextView = [[UITextView alloc] init];
myTextView.text = @"some text";
[self addSubview:myTextView];
[myTextView sizeToFit];
换行是通过在NSString(即myTextView.text)中写入
\n
引入的

这就是如何在UITextView中实现换行

NSString *aStr = [timeCodeArray objectAtIndex:textNumber];
textView.text = [aStr stringByReplacingOccurrencesOfString:@"\\n" withString:@"\n"];

你不能。您应该改用UITextView。