您的位置:首页 > 产品设计 > UI/UE

UILabel ,UITextView设置行间距

2016-01-08 11:55 597 查看
- (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;
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: