如何在 UISplitViewController UISplitViewControllerDisplayModePrimaryOverlay 模式下更改分隔符的颜色

How to change color of the separator in UISplitViewController UISplitViewControllerDisplayModePrimaryOverlay mode

所有相关问题我都google了,但是所有答案都是通过设置splitview背景颜色来改变颜色。它在 UISplitViewControllerDisplayModeAllVisible 模式下有效,但在 UISplitViewControllerDisplayModePrimaryOverlay 模式下无效。有谁能够帮我 ?非常感谢!

这是我的答案,在splitviewcontroller中添加一条1px的线

_seperateView = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, 1.0 / [UIScreen mainScreen].scale, CGRectGetHeight(self.view.frame)+20)];

_seperateView.image = [UIImage imageNamed:@"seprateLine"]

[self.view insertSubview:_seperateView atIndex:0];

并在 viewWillLayoutSubviews 中布局框架

  • (void)viewWillLayoutSubviews {

_seperateView.left = _masterNav.view.width + _masterNav.view.left;

}