我使用EGOTextView进行富文本编辑。但是lineHeight
的{{1}}似乎比EGOTextView
中的UITextView
略小,它们设置为相同的字体。
我试图在默认属性中设置kCTParagraphStyleSpecifierMinimumLineHeight
和kCTParagraphStyleSpecifierMaximumLineHeight
,但这不是一个好的解决方案,因为我需要插入必须修改lineHeight
的图像。任何帮助将不胜感激:)
EGOTextView.m
- (void)viewDidLoad {
[super viewDidLoad];
UISegmentedControl *segment = [[UISegmentedControl alloc] initWithItems:[NSArray arrayWithObjects:@"UITextView", @"EGOTextView", nil]];
segment.segmentedControlStyle = UISegmentedControlStyleBar;
[segment addTarget:self action:@selector(segmentChanged:) forControlEvents:UIControlEventValueChanged];
self.navigationItem.titleView = segment;
[segment release];
if (_textView==nil) {
UITextView *textView = [[UITextView alloc] initWithFrame:self.view.bounds];
textView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
textView.font = [UIFont systemFontOfSize:14];
[self.view addSubview:textView];
self.textView = textView;
[textView release];
}
if (_egoTextView==nil) {
EGOTextView *view = [[EGOTextView alloc] initWithFrame:self.view.bounds];
view.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
view.delegate = (id<EGOTextViewDelegate>)self;
[self.view addSubview:view];
self.egoTextView = view;
self.egoTextView.delegate = self;
[view release];
[self.egoTextView setFont:[UIFont systemFontOfSize:14]];
}
[segment setSelectedSegmentIndex:1];
}
答案 0 :(得分:1)
您可以将kCTParagraphStyleSpecifierLineSpacing
CTParagraphStyleSetting
的{{1}}设置为您想要分隔线的点数。或者,您也可以使用NSAttributedString
指定行高多个,以便将行高增加一个因子。
这是一个简单的例子:
kCTParagraphStyleSpecifierLineHeightMultiple