我使用EGOTextView进行富文本编辑。但是 的lineHeight
看起来EGOTextView
比 中的要小一些UITextView
,它们都设置了相同的字体。我尝试在默认属性中设置kCTParagraphStyleSpecifierMinimumLineHeight
and 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];
}