gpt4 book ai didi

ios - didDeselectRowAtIndexPath 仅在按下另一个单元格后调用

转载 作者:行者123 更新时间:2023-11-28 09:59:58 26 4
gpt4 key购买 nike

<分区>

事情是这样的:

我实现了一个带有自定义单元格的 UITableViewController..然后我用 viewcontroller to viewcontroller 替换了自动 segue cell to viewcontroller( Storyboard)。

来 self 的 UITableViewController 的代码:

// MARK: - Tableview managment

override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
var lobbycell = tableView.dequeueReusableCellWithIdentifier("lobbycell") as! LobbyTableViewCell
let row = indexPath.row
if let channel = lobbies[row].lobbyName {
lobbycell.lobbynameLabel.text = channel
}
if let usercount = lobbies[row].users?.count {
lobbycell.usercountLabel.text = "Anzahl Spieler: \(usercount)"
}
if let host = lobbies[row].host?.username {
lobbycell.hostnameLabel.text = "Host: \(host)"
}
return lobbycell
}

override func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return lobbies.count
}

override func tableView(tableView: UITableView, didDeselectRowAtIndexPath indexPath: NSIndexPath) {
let selectedLobby = lobbies[indexPath.row]
var loading = MBProgressHUD.showHUDAddedTo(self.view, animated: true)
PFLobby.joinLobbyInBackgroundWithBlock(selectedLobby, user: PFUser.currentUser()!) { (success, error) -> Void in
loading.hide(true)
if success {
self.performSegueWithIdentifier("joinLobby", sender: self)
} else {

}

}
}

问题来了:如果我点击一个单元格,它会变成灰色(就像被选中一样)但不会调用 didDeselectRowAtIndexPathfunc..仅当我单击另一个单元格时,它才会使用灰色(如选定)单元格的 indexPath 调用 didDeselectRowAtIndexPath

The stuck cell

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