注意点:
1.如果用SnapKit来手动布局,需要设置宽度或高度大小( 视宽度或者高度isVerticals属性而定)
leftView.snp.makeConstraints { (maker) in
maker.top.equalToSuperview()
maker.left.equalToSuperview()
maker.bottom.equalToSuperview()
maker.width.equalTo(leftViewWidth)
}
rightView.snp.makeConstraints{ (maker)in
maker.top.equalToSuperview()
maker.left.equalTo(leftView.snp.right)
maker.bottom.equalToSuperview()
//这一行如果不设置将导致无法完全展示左右两视图
maker.width.greaterThanOrEqualTo(rightViewWidth)
}
2.同时需要设置splitview的代理为viewcontroller,并且要实现以下两个方法
funcsplitView(_splitView:NSSplitView, constrainMinCoordinate proposedMinimumPosition:CGFloat, ofSubviewAt dividerIndex:Int) ->CGFloat{
return200
}
funcsplitView(_splitView:NSSplitView, constrainMaxCoordinate proposedMaximumPosition:CGFloat, ofSubviewAt dividerIndex:Int) ->CGFloat{
return320
}
这样才能确保多视图呈现
网友评论