NSScrollView 如何从左上角开始 [英] NSScrollView how to start from top left corner
问题描述
如何设置scrollView文档视图固定在左上角?如果 scrollView 足够大/大于其内容,则所有内容都是从下到上绘制的,看起来不正确.我必须覆盖 scrollView 的 isFlipped
?
How to set scrollView document view to be pinned to top left corner? If scrollView is big enough/bigger than its content, everything is drawn from bottom to up and it not looks right. I have to override isFlipped
of scrollView?
我在互联网上搜索并覆盖 isFlipped
以返回 true
并不是万能的.我不想让我的 documentView 翻转,因为那样我必须在那个类中进行更改以使一切看起来像我想要的.
I was searching internet and overriding isFlipped
to return true
is not everything. I don't want to make my documentView flipped because then I have to make changes in that class to make everything looks like I want.
推荐答案
我创建了简单的 NSView
类作为我想要在我的 scrollView 中包含的元素的容器,一切看起来都很完美.我希望这会对某人有所帮助!
I created simple NSView
class as an container for elements that i want to have inside my scrollView and everything looks perfect. I hope this will help someone!
@interface FlippedView : NSView
@end
和实施:
@implementation FlippedView
- (void)drawRect:(NSRect)dirtyRect {
[super drawRect:dirtyRect];
// Drawing code here.
}
- (BOOL) isFlipped
{
return YES;
}
@end
这篇关于NSScrollView 如何从左上角开始的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!