gpt4 book ai didi

ios - 单击段控制表单元格内的按钮时无法执行 segue

转载 作者:行者123 更新时间:2023-12-01 16:01:44 25 4
gpt4 key购买 nike

enter image description here

我可以根据以下引用检索段控制中的帖子,帖子单元格中有评论按钮,单击它时会出现“文档引用必须有偶数个段,但帖子有 1”的错误

屏幕截图也附在此处

我检查了许多类似的问题,他们都指出了文档引用错误,但是如果 doc ref 错误,那么它是如何在 tableview 中检索列表并在单击按钮时给出错误的。

    let postsRef = Firestore.firestore().collection("posts").whereField("post_author_id", isEqualTo: Auth.auth().currentUser!.uid
).whereField("l3", isEqualTo: false).limit(to: 50)

cell code

func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "MyCell", for: indexPath) as! PostCell
switch segmentControl.selectedSegmentIndex{
case 0:
cell.Mpost1 = post1[indexPath.row]
cell.commentbutton.tag = indexPath.row
cell.commentbutton.addTarget(self, action: #selector(toComments(_:)), for: .touchUpInside)

break
case 1:
cell.Mpost2 = post2[indexPath.row]
break

default:
break
}
return cell
}

@objc func toComments(_ sender: AnyObject) {

let commentbutton = sender as! UIButton
let post = pendingPost[commentbutton.tag]
postKey = post._documentId // or what key value it is
print("hello")
performSegue(withIdentifier: "toCommentsList2", sender: self)

}

最佳答案

关于ios - 单击段控制表单元格内的按钮时无法执行 segue,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58372632/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com