- (UITextView *)instructionTextView{
if (!_instructionTextView) {
_instructionTextView = [[UITextView alloc] init];
_instructionTextView.layer.borderWidth = 1.0f;
_instructionTextView.layer.borderColor = HexRGB(0xe6e6e6).CGColor;
_instructionTextView.backgroundColor = HexRGB(0xf9f9f9);
_instructionTextView.font = [UIFont systemFontOfSize:15];
_instructionTextView.delegate = self;
_instructionTextView.textColor = HexRGB(0x676767);
_instructionTextView.textContainerInset = UIEdgeInsetsMake(10, 5, 10, 5);
_instructionTextView.autoresizesSubviews = NO;
NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc] init];
paragraphStyle.lineSpacing = 7;// 字体的行间距
NSDictionary *attributes = @{
NSFontAttributeName:[UIFont systemFontOfSize:14],
NSParagraphStyleAttributeName:paragraphStyle
};
_instructionTextView.attributedText = [[NSAttributedString alloc] initWithString:@" " attributes:attributes];
}
return _instructionTextView;
}
获取内容的size大小:
self.achievementSize = [self.achievementTextView.text boundingRectWithSize:CGSizeMake(wei,2000.0f) options:NSStringDrawingUsesLineFragmentOrigin attributes:attributes context:nil].size;