我对pod SwipeCellKit的理解有问题。
我有这个简单的设置(用于检索数据的Firebase)
在我的:
class MyFriendsViewController: UIViewController,UITableViewDataSource, UITableViewDelegate {
@IBOutlet weak var MyFriendsTableview: UITableView!
var ref: DatabaseReference!
var MyFriendslist = [MyFriendsModel]()
我有我的cellForRow就像这样:
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "CustomFriends", for: indexPath) as! MyFriendsTableViewCell
// let cell = tableView.dequeueReusableCell(withIdentifier: "CustomFriends") as! SwipeTableViewCell
// cell.delegate = self
当我尝试实现swipeCellKit时,如果我放入以下内容,我将从MyFriendTableViewCell(UIimage,标签引用)中删除我的引用:
let cell = tableView.dequeueReusableCell(withIdentifier: "CustomFriends") as! SwipeTableViewCell
cell.delegate = self
任何人都知道如何取消阻止?
谢谢!
只需改变这个:
class MyFriendsTableViewCell: UITableViewCell { ...
对此:
class MyFriendsTableViewCell: SwipeTableViewCell { ...
我们刚刚继承了继承UITableViewCell的SwipeTableViewCell属性。完成此更改后,您将能够使用MyFriendsTableViewCell
属性和SwipeTableViewCell
属性。
更新的代码:
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "CustomFriends", for: indexPath) as! MyFriendsTableViewCell
cell.delegate = self
...
cell.yourMyFriendsTableCellProperty = ...
return cell
}