Ios 固定视图';自动布局的位置选择
下面的代码在iOS 10中工作。我可以向左滑动单元格,并将其“trickView”固定在UITableView的边缘。但它在iOS 11中不起作用。(滑动动画由UITableViewRowAction完成) 如果有人知道如何在iOS 11上工作,我将不胜感激Ios 固定视图';自动布局的位置选择,ios,uitableview,autolayout,ios11,uitableviewrowaction,Ios,Uitableview,Autolayout,Ios11,Uitableviewrowaction,下面的代码在iOS 10中工作。我可以向左滑动单元格,并将其“trickView”固定在UITableView的边缘。但它在iOS 11中不起作用。(滑动动画由UITableViewRowAction完成) 如果有人知道如何在iOS 11上工作,我将不胜感激 func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { let cell = table
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "CellId", for: indexPath) as! SomeBeautifulCell
if cell.fixedLeadingConstraint == nil {
let constraint = NSLayoutConstraint(item: cell.trickView, attribute: .leading, relatedBy: .equal, toItem: tableView, attribute: .leading, multiplier: 1, constant: 10)
cell.fixedLeadingConstraint = constraint
DispatchQueue.main.async {
tableView.addConstraint(constraint)
}
}
return cell
}