自动调整以编程方式创建的子视图的大小
我有一个 NSSplitView。在该拆分视图的左侧窗格中,我有一个 NSTableView 和一个以编程方式创建的自定义视图。我正在使用 代表 来确保我的两个窗格不会同时调整大小。
我因此添加了我的自定义视图:
BWAnchoredButtonBar *anchoredButtonBar = [[[BWAnchoredButtonBar alloc] initWithFrame:[leftPane bounds]] autorelease];
[leftPane addSubview:anchoredButtonBar];
并且它似乎工作正常。当我运行我的应用程序时,一切正常。现在,我的问题是,当我调整分割视图窗格的大小时,自定义视图不会随之调整大小,在它和 NSSplitView 的分隔线之间留下难看的空白。
我想我想问的是,如何以编程方式设置IB可视化设置的弹簧和支柱?
另外,我无法使用 IB,因为 Xcode 4 不支持 IB 插件。
I have a NSSplitView. On the left pane of that split view I have an NSTableView and a custom view created programmatically. I'm using a delegate to make sure my two panes don't resize at the same time.
I add my custom view thus:
BWAnchoredButtonBar *anchoredButtonBar = [[[BWAnchoredButtonBar alloc] initWithFrame:[leftPane bounds]] autorelease];
[leftPane addSubview:anchoredButtonBar];
And it seems to work ok. When I run my application everything works fine. Now, my problem is that when I resize the split view pane, the custom view does not resize with it leaving an ugly white space between it and the divider of the NSSplitView.
I guess what I want to ask is, how can I programmatically set the springs and struts that IB sets visually?
Also, I can't use IB because Xcode 4 does not support IB plugins.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
-[NSView setAutoresizingMask:]
是您如何以编程方式设置弹簧和支柱。-[NSView setAutoresizingMask:]
is how you set springs and struts programmatically.