我希望有人能帮助我解决这个问题。无论我做什么,无论是通过IB还是在代码中,我都无法使新的NSSplitViewController及其项目可折叠或保持其优先级。XCode6 NSSplitViewController控制优先级和canCollapse不起作用
它不能从界面生成器做虽然这种视频显示其他内容:https://www.youtube.com/watch?v=ZIIuPo4F6tQ
我只能让SPLITVIEW项目在代码最小宽度但是这是相当多了。我没有运气测试Swift和Objective-C实现。
这是我写的SWIFT:
override func viewDidLoad() {
super.viewDidLoad()
// ---
var left: NSSplitViewItem = self.splitViewItems[0] as NSSplitViewItem
var right: NSSplitViewItem = self.splitViewItems[1] as NSSplitViewItem
// ---
// NOTE: these are not working properly in the interface builder for now
self.view.addConstraint(NSLayoutConstraint(
item: left.viewController.view,
attribute: NSLayoutAttribute.Width,
relatedBy: NSLayoutRelation.GreaterThanOrEqual,
toItem: nil,
attribute: NSLayoutAttribute.NotAnAttribute,
multiplier: 0,
constant: 200
))
self.view.addConstraint(NSLayoutConstraint(
item: right.viewController.view,
attribute: NSLayoutAttribute.Width,
relatedBy: NSLayoutRelation.GreaterThanOrEqual,
toItem: nil,
attribute: NSLayoutAttribute.NotAnAttribute,
multiplier: 0,
constant: 200
))
// ---
// NOTE: these are not working in the interface builder neither here but set anyway to demonstrate the problem
left.canCollapse = true // has no effect
right.canCollapse = true // has no effect
// ---
// NOTE: this is not working in the interface builder neither here but set anyway to demonstrate the problem
right.holdingPriority = 1.0 // has no effect
}
这一切都不在所有工作。我甚至试图把这个调用转移到函数底部的超级,但没有多少运气。
我想知道是否有人发现了一个解决方案,或者我正在做一些完全错误的事情?
呃,我认为乘数应该是1,而不是0. – 2014-12-26 16:28:58