这就是我现在所拥有的(用Swift编写的乐趣),但它有多种方式:
@IBAction func toggleSourceList(sender: AnyObject?) { let isOpen = !splitVIEw.isSubvIEwCollapsed(sourceList.vIEw.supervIEw!) let position = (isOpen ? 0 : self.lastWIDth) if isOpen { self.lastWIDth = sourceList.vIEw.frame.size.wIDth } NSAnimationContext.runAnimationGroup({ context in context.allowsImplicitAnimation = true context.timingFunction = camediatimingFunction(name: kcamediatimingFunctionEaseIn) context.duration = self.duration self.splitVIEw.setposition(position,ofdivIDerAtIndex: 0) },completionHandler: { () -> VoID in })}
期望的行为和外观是Mail.app,它的动画效果非常好.
我有一个完整的示例应用程序在https://github.com/mdiep/NSSplitViewTest可用.
解决方法 Objective-C的:[[splitVIEwItem animator] setCollapse:YES]
迅速:
splitVIEwItem.animator().collapsed = true
来自Apple的帮助:
总结Whether or not the child VIEwController corresponding to the SplitVIEwItem is collapsed in the SplitVIEwController. The default is NO. This can be set with the animator proxy to animate the collapse or uncollapse. The exact animation used can be customized by setting it in the -animations dictionary with a key of “collapsed”. If this is set to YES before it is added to the SplitVIEwController,it will be initially collapsed and the SplitVIEwController will not cause the vIEw to be loaded until it is uncollapsed. This is KVC/KVO compliant and will be updated if the value changes from user interaction.
以上是内存溢出为你收集整理的cocoa – 如何在使用自动布局时使用动画折叠NSSplitView窗格?全部内容,希望文章能够帮你解决cocoa – 如何在使用自动布局时使用动画折叠NSSplitView窗格?所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)