UITextView只能显示两行问题

   需求: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

猜你喜欢

转载自www.cnblogs.com/widgetbox/p/9726041.html
今日推荐