大佬教程收集整理的这篇文章主要介绍了以编程方式创建的UITextView不再使用iOS 9滚动,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
- (void)createTextView
//1. Create the text storage that BACks the editor. NSDictionary *attrs = @{NSFontAttributename: [UIFont preferredFontForTextStyle:UIFontTextStyleBody]}; NSAttributedString *attrString = [[NSAttributedString alloc] initWithString:notesAndReference attributes:attrs]; _textStorage = [[SyntaxHighlightTextStorage alloc] init]; [_textStorage appendAttributedString:attrString]; CGRect newTextViewRect = self.view.bounds; //2. Create the layout manager. NSLayoutManager *layoutManager = [[NSLayoutManager alloc] init]; //3. Create a text container. CGSize containerSize = CGSizeMake(newTextViewRect.size.width,CGFLOAT_MAX); NSTextContainer *container = [[NSTextContainer alloc] initWithSize:containerSize]; container.widthTracksTextView = YES; [layoutManager addTextContainer:container]; [_textStorage addLayoutManager:layoutManager]; //4. Create a UITextView. textView = [[UITextView alloc] initWithFrame:newTextViewRect textContainer:container]; textView.scrollEnabled = YES; textView.editable = YES; textView.delegate = self; [self.view addSubview:textView];
}
以上是大佬教程为你收集整理的以编程方式创建的UITextView不再使用iOS 9滚动全部内容,希望文章能够帮你解决以编程方式创建的UITextView不再使用iOS 9滚动所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。