简体   繁体   中英

UISplitViewController with tableView as detailView bug

I make application with UISplitViewController. Above it i have contaner controller in which i override:

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

To get same functionality for iPhones and iPads.

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

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. I make this constaint priority to low and add another constranint to the leftAcnchor of cell with required priority.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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