我已经为 tableview 单元设置了一个领先的滑动操作,它添加到购物车。我还没有实现任何尾随滑动操作方法,但我仍然为每个单元格执行删除操作。下面是我所有 tableView 方法的代码。我还附上了模拟器中的一张图片。
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return 10
}
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
if (indexPath.row == 0) {
return 267
}
else {
return 85
}
}
//tableview methods
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
Run Code Online (Sandbox Code Playgroud)
// 对于第一个单元格
if (indexPath.row == 0){
let cell = storeInfoTable.dequeueReusableCell(withIdentifier: "storeinfocell1", for: indexPath) as! CustomStoreInfoTableOneViewCell
return cell
}
Run Code Online (Sandbox Code Playgroud)
// 对于剩余的单元格
let cell = storeInfoTable.dequeueReusableCell(withIdentifier: "storeItemCell", for: …Run Code Online (Sandbox Code Playgroud)