即使内容足够大,NSScrollView也不显示滚动条
我有这个类:
标题:
@interface vcMain : NSWindowController {
IBOutlet NSView *scroll;
}
@property (retain) IBOutlet NSView *scroll;
-(IBAction)test:(id)sender;
@end
来源:
@implementation vcMain
@synthesize scroll;
-(IBAction)test:(id)sender {
vItem *item = [[vItem alloc] initWithNibName:@"vItem" bundle:nil];
NSView *view = [item view];
[view setFrame:NSMakeRect(0, 0, 300, 600)];
[view setAutoresizingMask:( NSViewHeightSizable) ];
[scroll addSubview:view];
}
@end
*滚动是窗口内容视图中边框滚动视图中的自定义视图。
vItem 是 ViewController 的子类,上面有一些东西来标识它的位置。
问题:将 vcMain 的大小从默认的 300x600 调整为 150x300 时,我看不到任何滚动条。
我做错了什么?
汤姆
I have this class:
Header:
@interface vcMain : NSWindowController {
IBOutlet NSView *scroll;
}
@property (retain) IBOutlet NSView *scroll;
-(IBAction)test:(id)sender;
@end
Source:
@implementation vcMain
@synthesize scroll;
-(IBAction)test:(id)sender {
vItem *item = [[vItem alloc] initWithNibName:@"vItem" bundle:nil];
NSView *view = [item view];
[view setFrame:NSMakeRect(0, 0, 300, 600)];
[view setAutoresizingMask:( NSViewHeightSizable) ];
[scroll addSubview:view];
}
@end
*scroll is a Custom View in a Bordered Scroll View in the Content View of a Window.
vItem is a ViewController subclass with some things on it to identify its position.
Problem: When resizing my vcMain from the default 300x600 to 150x300, I don't see any scrollbars.
What am I doing wrong?
Tom
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
解决了
,其实很简单。调整视图的大小显然也调整了子视图的大小,因此没有必要显示滚动条 - 但是,由于子视图中的元素没有移动,我没有注意到子视图正在调整大小。
通过更正视图的大小调整来解决。
Solved
It was simple, actually. Resizing the view apparently also resized the subview so it wasn't neccessary to show the scrollbars - however, as the elements in the subview didn't move, I didn't notice that the subview was resizing.
Solved by correcting the resizing of the view.