KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I am trying to implement smooth scrolling in a chat history view I implemented, however if the content I append is big enough the smooth scroll will only scroll for a few lines. My first guess was that the view did not redraw itself yet.. not the case, even when forcing immediate drawing with -display it still breaks. - (void)scrollAnimated:(BOOL)animated { if( animated ) { NSClipView *clipView = [[_chatHistoryView enclosingScrollView] contentView]; [NSAnimationContext beginGrouping]; [[NSAnimationContext currentContext] setDuration:0.100f]; NSPoint constrainedPoint = [clipView constrainScrollPoint:NSMakePoint(0, CGFLOAT_MAX)]; [[clipView animator] setBoundsOrigin:constrainedPoint]; [NSAnimationContext endGrouping]; } else { NSRange range; range.location = [[_chatHistoryView textStorage] length]; range.length = 1; [_chatHistoryView scrollRangeToVisible:range]; } } What am I doing wrong?
Tags (comma-separated)
Save Edits
Cancel