我正在锁定方法中的解决方案
func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: UIIndexPath) {
}
在我选择一行后它应该改变颜色并移动到数组的末尾,另一个应该向上移动
最佳答案
要向下移动行,您可以这样做:
func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: UIIndexPath) {
//move selected cell down to last row
tableView.moveRowAtIndexPath(indexPath, toIndexPath:NSIndexPath(forRow: tableView.numberOfRowsInSection(indexPath.section)-1, inSection: indexPath.section))
}
要更改颜色,请参阅 How to change color of UITableViewCell when selecting?
关于ios - 选中单元格后如何移动,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35010074/