2016-09-14 5 views
0

私はオブジェクトIDでParseユーザーのリストを表示するtableviewを持っています。私はそれをタップすると、それに対応するobjectIdを持つ新しいView Controllerにあなたを押し込もうとしています。 objectIdのセルで印刷が正常に行われ、データが新しいView Controllerに渡されることもありますが、クエリから取得された最後のオブジェクトIDを渡すだけです。もし誰かが助けてくれそうな行のobjectIdを送る方法を考えてくれたら助かります。ここに私のコードは次のとおりです。selectで同じデータを渡すテーブルビュー

@IBOutlet weak var objectIdData: UILabel! 

internal func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell { 

    let cell:ChatTableCell = self.tableView.dequeueReusableCellWithIdentifier("ChatCell") as! ChatTableCell 
    let user = self.friends[indexPath.row] 
    self.objectIdData?.text = String(user.objectId!) 
    cell.cellTitle?.text = String(user.objectId).uppercaseString 
    return cell 

} 

func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) { 


    self.tableView.deselectRowAtIndexPath(indexPath, animated: true) 
    let user = self.friends[indexPath.row] 
    let secondViewController = self.storyboard!.instantiateViewControllerWithIdentifier("DetailViewController") as! DetailViewController 
    secondViewController.lblDetail = objectIdData 
    self.navigationController!.pushViewController(secondViewController, animated: true) 

} 

だから、次のビューコントローラ上lblDetailにOBJECTIDを渡しますが、常に同じOBJECTIDではなく、そのユーザ/行に関連付けられている1。前もって感謝します。

答えて

0

didSelectRowAtIndexPathでは、secondViewControllerにUI要素(objectIdData isa UILabel)を設定しています。

cellForRowAtIndexPathと同じように、lblDetailのテキストを設定したいと思っています。

関連する問題