UITextField 怎样设置让它在输入的时候自动换行

 我来答
匿名用户
推荐于2016-02-26
展开全部
- (void)initFeedBackViews
{
//设置页面的背景颜色
UIColor *ViewBgColor = [UIColor colorWithRed:(247.0f/255.0f) green:(247.0f/255.0f) blue:(247.0f/255.0f) alpha:1.0f];
self.view.backgroundColor = ViewBgColor;

UILabel *fix_feed_label = [[UILabel alloc] initWithFrame:CGRectMake(10, 0, 70, 30)];
fix_feed_label.text = @"意见内容";
fix_feed_label.backgroundColor = [UIColor clearColor];
fix_feed_label.textColor = [UIColor blackColor];

_content_textView = [[UITextView alloc] initWithFrame:CGRectMake(10, 25, 300, 80)];
_content_textView.font = [UIFont boldSystemFontOfSize:13];
_content_textView.delegate = self;
//设置键盘,使换行变为完成字样
_content_textView.keyboardType = UIKeyboardAppearanceDefault;
_content_textView.returnKeyType = UIReturnKeyDone;

_placeholder_label = [[UILabel alloc] initWithFrame:CGRectMake(12, 25, 300, 30)];
_placeholder_label.text = @"请留下您的宝贵意见或建议(不少于10个汉字)";
_placeholder_label.font = [UIFont boldSystemFontOfSize:13];
_placeholder_label.textColor = [UIColor lightGrayColor];
_placeholder_label.layer.cornerRadius = 10;
_placeholder_label.layer.masksToBounds = YES;

UILabel *fix_contact_label = [[UILabel alloc]initWithFrame:CGRectMake(10, 105, 160, 30)];
fix_contact_label.text = @"联系方式 (选填)";
fix_contact_label.backgroundColor = [UIColor clearColor];
fix_contact_label.textColor = [UIColor blackColor];

_contact_field = [[UITextField alloc] initWithFrame:CGRectMake(15, 130, 300, 30)];
[_contact_field setBorderStyle:UITextBorderStyleNone];
_contact_field.font = [UIFont boldSystemFontOfSize:13];
_contact_field.contentVerticalAlignment =UIControlContentVerticalAlignmentCenter;
_contact_field.keyboardType = UIKeyboardAppearanceDefault;
_contact_field.returnKeyType = UIReturnKeyDone;
_contact_field.placeholder = @"手机号码或EMAIL";
_contact_field.delegate = self;

_submit_button = [UIButton buttonWithType:UIButtonTypeCustom];
[_submit_button setFrame: CGRectMake(0, 0, 55, 27)];
UIColor *sequenceColor = [UIColor colorWithRed:(246.0f/255) green:(109.0f/255.0f) blue:(9.0f/255.0f) alpha:1.0f];
_submit_button.backgroundColor = sequenceColor;
[_submit_button setTitle:@"提交" forState:UIControlStateNormal];
[_submit_button setTitleColor:[UIColor whiteColor]forState:UIControlStateNormal];
[_submit_button addTarget:self action:@selector(clickSubmit:)forControlEvents:UIControlEventTouchUpInside];
self.navigationItem.rightBarButtonItem = [[UIBarButtonItemalloc]initWithCustomView:_submit_button];

[self.view addSubview:fix_feed_label];
[self.view addSubview:fix_contact_label];
[self.view addSubview:_content_textView];
[self.view addSubview:_placeholder_label];
[self.view addSubview:_contact_field];
}
本回答被提问者和网友采纳
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
汗骥夹谷越泽
2020-01-26 · TA获得超过3813个赞
知道大有可为答主
回答量:3116
采纳率:24%
帮助的人:186万
展开全部
选择欲设置自换行单元格,按ctrl+1打单元格格式框,切换齐式选项卡:勾选自换行
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式