此代码在更新到ios 11和swift 4之前完全正常工作,我不知道发生了什么我还附上了一个显示问题的视频。
我不能再移动行了。有什么建议吗? 感谢。
override func tableView(_ tableView: UITableView, canMoveRowAt indexPath: IndexPath) -> Bool {
return true
}
//Do the Move action
override func tableView(_ tableView: UITableView, moveRowAt sourceIndexPath: IndexPath, to destinationIndexPath: IndexPath) {
let moveMainArray:String = mainArrayTableName[sourceIndexPath.row]
mainArrayTableName.remove(at: sourceIndexPath.row)
mainArrayTableName.insert(moveMainArray, at: destinationIndexPath.row)
print(mainArrayTableName[destinationIndexPath.row])
let moveFirstName:String = firstName[sourceIndexPath.row]
firstName.remove(at: sourceIndexPath.row)
firstName.insert(moveFirstName, at: destinationIndexPath.row)
print(firstName[destinationIndexPath.row])
let moveLastName:String = lastName[sourceIndexPath.row]
lastName.remove(at: sourceIndexPath.row)
lastName.insert(moveLastName, at: destinationIndexPath.row)
print(lastName[destinationIndexPath.row])
let moveTotalAmount:String = totalAmount[sourceIndexPath.row]
totalAmount.remove(at: sourceIndexPath.row)
totalAmount.insert(moveTotalAmount, at: destinationIndexPath.row)
print(totalAmount[destinationIndexPath.row])
let moveLastAmount:String = lastAmount[sourceIndexPath.row]
lastAmount.remove(at: sourceIndexPath.row)
lastAmount.insert(moveLastAmount, at: destinationIndexPath.row)
print(lastAmount[destinationIndexPath.row])
let moveAddress:String = address[sourceIndexPath.row]
address.remove(at: sourceIndexPath.row)
address.insert(moveAddress, at: destinationIndexPath.row)
print(address[destinationIndexPath.row])
let movePhoneNbr:String = phoneNbr[sourceIndexPath.row]
phoneNbr.remove(at: sourceIndexPath.row)
phoneNbr.insert(movePhoneNbr, at: destinationIndexPath.row)
print(phoneNbr[destinationIndexPath.row])
let moveLastPayment:String = lastPaymentDate[sourceIndexPath.row]
lastPaymentDate.remove(at: sourceIndexPath.row)
lastPaymentDate.insert(moveLastPayment, at: destinationIndexPath.row)
print(lastPaymentDate[destinationIndexPath.row])
let moveNextPayment:String = nextPaymentDate[sourceIndexPath.row]
nextPaymentDate.remove(at: sourceIndexPath.row)
nextPaymentDate.insert(moveNextPayment, at: destinationIndexPath.row)
print(nextPaymentDate[destinationIndexPath.row])
let moveRemaining:String = remainingAmount[sourceIndexPath.row]
remainingAmount.remove(at: sourceIndexPath.row)
remainingAmount.insert(moveRemaining, at: destinationIndexPath.row)
print(remainingAmount[destinationIndexPath.row])
print(userID[destinationIndexPath.row])
}
视频链接:https://www.dropbox.com/s/0c0tlldbehrpslo/ScreenRecording_04-10-2018%2021-17-03.MP4?dl=0
再次感谢
答案 0 :(得分:0)
答案 1 :(得分:0)
如果您的代码中有任何机会:
navigationController?.hidesBarsOnSwipe = true
然后将其设置为false,优先考虑tableview的scrollview。
答案 2 :(得分:0)
答案 3 :(得分:-1)
问题不在代码本身中。出于某种原因,我有一个导航控制器,这导致了问题。一旦删除,重新订购现在完美无缺。谢谢你的帮助。