首页 > 其他 > 详细

UITextView只能显示两行问题

时间:2018-09-29 20:05:23      阅读:189      评论:0      收藏:0      [点我收藏+]

   需求:UITextView只能显示两行

    UITextView * textView = [[UITextView alloc]init];

    textView.frame = CGRectMake(20, 30, [UIScreen mainScreen].bounds.size.width-40, [UIScreen mainScreen].bounds.size.height-30);

    textView.font= [UIFont systemFontOfSize:15];    

    textView.delegate =  self;

    [self.view addSubview:view];

   网络资料显示方法:view.textContainer.maximumNumberOfLines = 2;但是这个方法显示两行但是获取到的字符串不止两行,所有要严格获取两行文本文字,此方法没有效果,只能通过判断textView.text.length来限制输入的内容。

 

by:lm

 

UITextView只能显示两行问题

原文:https://www.cnblogs.com/widgetbox/p/9726041.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!