开发者

how to force redraw contents inside a NSScrollView

I put NSTextView + NSImageView + NSMatrix + NSTextView in a NSScrollView. And I scroll this scrollview to top using following code -

NSPoint pointToScrollTo = NSMakePoint(0, NSMaxY([[singleScrollView documentView] frame]) - [[singleScrollView contentView] bounds].size.height);
[[singleScrollView contentView] scrollToPoint: pointToScrollTo];
[singleScrollView reflectScrolledClipView: [singleScrollView contentView]];

But the problem is when it finish scrolling to top the view gets messed up.. Here is a screenshot -

how to force redraw contents inside a NSScrollView

I tried to force redraw contents with no luck using this -

[txtQTitle setNeedsDisplay:YES];
[viewOptions setNeedsDisplay:YES];
[singleScrollView setNeedsDisplay:YES];

Do anyone have any idea why this is causing and how should be solved?

Edit 1 - When I scroll the view using mouse scroll some part of the singleScrollView开发者_开发知识库 gets ok .. here is a screenshot of this -

how to force redraw contents inside a NSScrollView


Try with [[yourScrollView contentView] setCopiesOnScroll:NO]. I think, it should solve your problem.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜