简体   繁体   English

UISplitViewController与tableView作为detailView错误

[英]UISplitViewController with tableView as detailView bug

I make application with UISplitViewController. 我用UISplitViewController制作应用程序。 Above it i have contaner controller in which i override: 在它上面,我有contaner控制器,在其中我可以覆盖:

let tc = UITraitCollection(horizontalSizeClass: .regular)
self.setOverrideTraitCollection(tc, forChildViewController: svc)

To get same functionality for iPhones and iPads. 为iPhone和iPad获得相同的功能。

svc.preferredDisplayMode = UISplitViewControllerDisplayMode.primaryHidden
svc.preferredPrimaryColumnWidthFraction = 0.8
svc.maximumPrimaryColumnWidth = 500

When i activate PrimaryViewController SplitViewController preferredDisplayMode is becoming allVisible and the detailView(tableView) swipes right but whith bug as on screens 当我激活PrimaryViewController SplitViewController preferredDisplayMode变为allVisible时,detailView(tableView)向右滑动,但屏幕上出现了bug

primaryViewBug primaryViewBug

left side labels and right side label are driven on each other Will be thankful for any ideas on how to correct this bug 左侧标签和右侧标签相互驱动将非常感谢您对如何纠正此错误的任何想法

The problem was solved. 问题解决了。 In my tableViewCell i have rightLabel contraint to the rightAnchor of cell. 在我的tableViewCell中,我对单元格的rightAnchor有rightLabel约束。 I make this constaint priority to low and add another constranint to the leftAcnchor of cell with required priority. 我将此约束优先级设置为低,然后向具有所需优先级的单元格的leftAcnchor中添加另一个约束。

let rightAnch = rigthtLabel.rightAnchor.constraint(equalTo: rightAnchor, constant: -8)
    rightAnch.priority = .defaultLow
    rightAnch.isActive = true
let leftAnch = rigthtLabel.leftAnchor.constraint(greaterThanOrEqualTo: leftAnchor, constant: 200)
    leftAnch.priority = .required
    leftAnch.isActive = true

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM