実装したチャット履歴ビューにスムーズスクロールを実装しようとしていますが、追加するコンテンツが十分に大きい場合、スムーズスクロールは数行しかスクロールしません。
私の最初の推測では、ビューはまだ再描画されていないということでした..そうではなく、 -display で即時描画を強制しても、まだ壊れています。
- (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];
}
}
私は何を間違っていますか?