0
私はいくつかのアプリを作ってIPhoneを起動したようですが、機能的にプログラムされたものが出現する前に、テーブルビューのセルを押さなければなりません。なぜ誰かがそれを修正する方法を教えてもらえますか?ここなぜ私はそれを開くために、テーブルビュー内のセルを押さなければならないのですか?
が代わりにdidSelectRowAtを使用する例
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
let message = messages[indexPath.row]
let chatPartnerId: String?
if message.fromId == FIRAuth.auth()?.currentUser?.uid{
chatPartnerId = message.toId
}else{
chatPartnerId = message.fromId
}
let ref = FIRDatabase.database().reference().child("users").child(chatPartnerId!)
ref.observeSingleEvent(of: .value, with: { (snapshot) in
guard let dictionary = snapshot.value as? [String:AnyObject] else{
return
}
let user = User()
user.uid = chatPartnerId
user.setValuesForKeys(dictionary)
chosenUser = user
self.performSegue(withIdentifier: "chatLog1", sender: nil)
})
}
あなたは、コードそのトリガーの例を与えることができますこれらのアクションの1つと、実行している場所はどこですか? –