HTMLLabel
HTMLLabel copied to clipboard
Big delay when adding HTMLLabel to UIScrollView
I use this fantastic Piece of Code, but i have a strange problem! Everything works fine until i want to scroll! It took 1-2 seconds until the ScrollView starts scrolling, what could be the problem?
self.htmlLabel = [[HTMLLabel alloc]init];
self.htmlLabel.stylesheet = @{
@"html": @{HTMLTextSize: @12},
@"h2": @{HTMLTextAlignment: @(NSTextAlignmentCenter)},
@"a": @{HTMLFont: @"Arial", HTMLTextColor: [UIColor blueColor]},
@"a:active": @{HTMLTextColor: [UIColor purpleColor]},
@".green": @{HTMLTextColor: [UIColor greenColor], HTMLBold: @YES}
};
self.htmlLabel.text = item.text;
CGRect frame = self.htmlLabel.frame;
frame.size.height = [self.htmlLabel sizeThatFits:CGSizeMake(getDisplayWidth(), CGFLOAT_MAX)].height;
self.htmlLabel.frame = frame;
[self addSubview:self.htmlLabel];
EDIT: Ok, looks like these Methods in HTMLLabel.m are the Reason for the delay when i try to scrolling:
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
- (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event
If i comment them out, everything works fine, but of course thats not really is a good solution xD