如何做崩溃和扩展视图在Mac应用程序? [英] How to do collapse and expand view in mac application?

查看:261
本文介绍了如何做崩溃和扩展视图在Mac应用程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是新的mac应用程序开发,这里我想在我的自定义视图(NSView)中展开和折叠视图



这里的示例图像



>



如何在NSViewController中实现这种类型的折叠和展开单元格,而不是在NSWindow ...



是否可以使用NSTableView?



我知道这是一个简单的问题,但我面临的问题。



请给我建议一些示例代码或链接..



感谢

解决方案

折叠/展开可以通过调整自动布局约束

  @property(nonatomic,weak)IBOutlet NSLayoutConstraint * moreInfoBoxHeight; 

[[self.moreInfoBoxHeight animator] setConstant:75];

Apple使用NSStackView在 https://developer.apple.com/library/mac/samplecode/InfoBarStackView/Introduction/Intro.html p>

I am new to mac application development, here i want to do expand and collapse view in my custom view(NSView)

here the sample image

How can i achieve these kind of collapse and expand cell in NSViewController not in NSWindow...

Is it possible using NSTableView?

I know its a simple question but i facing problem.

Please suggest me some sample code or links..

Thanks

解决方案

Collapsing / expanding can be implemented by adjusting auto layout constraints in the action method of the disclosure triangle button.

@property (nonatomic, weak) IBOutlet NSLayoutConstraint *moreInfoBoxHeight;

[[self.moreInfoBoxHeight animator] setConstant:75];

Apple has sample code using NSStackView at https://developer.apple.com/library/mac/samplecode/InfoBarStackView/Introduction/Intro.html

这篇关于如何做崩溃和扩展视图在Mac应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆