私はユーザーが1つのセルで2つの画像のいずれかを選択するアプリケーションを開発しています。どのテーブルセルがスウィフトでクリックされたかを検出する方法2
がどのように私は、ユーザーが選択されているセルの投票ボタンを押したときに検出することができます:私のプロトタイプセルは次のようになりますか?
私のtableViewコード:
override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let cellIdentifier = "NewTableViewCell"
let cell = tableView.dequeueReusableCellWithIdentifier(cellIdentifier, forIndexPath: indexPath) as! NewTableViewCell
//For left image
if let url:NSURL? = NSURL(string: self.polls[indexPath.row].poll_photo1){
cell.leftImage.sd_setImageWithURL(url)
}
//For right image
if let url:NSURL? = NSURL(string: self.polls[indexPath.row].poll_photo2){
cell.rightImage.sd_setImageWithURL(url)
}
//For user picture
if let url:NSURL? = NSURL(string: self.polls[indexPath.row].users[0].user_photo){
cell.userPicture.sd_setImageWithURL(url)
}
// gets username and text
cell.userName.text=self.polls[indexPath.row].users[0].user_name
cell.description.text = self.polls[indexPath.row].poll_textfield
return cell
}
マイウェブAPI:
最初に投票をどのように処理していますか? –
'NewTableViewCell'クラスで扱われるようです。 – trojanfoe
私はあなたのスウィフトコードを意味しました。あなたはまだ何か試してみませんか? –