1
我有一個數組的BackendlessUsers填充在tableView中。我如何在didSelectRowAtIndexPath函數中傳遞用戶?Swift/tableView傳遞數據與instantiateViewControllerWithIdentifier
var deejays: [BackendlessUser] = []
func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
print("You selected cell #\(indexPath.row)!")
self.tableView.deselectRowAtIndexPath(indexPath, animated: true)
**let user = deejays[indexPath.row]**
let storyboard = UIStoryboard(name: "Main", bundle: nil)
let vc = storyboard.instantiateViewControllerWithIdentifier("DJProfileAsUserVC") as! DJProfileAsUserVC
dispatch_async(dispatch_get_main_queue()) {
self.presentViewController(vc, animated: true, completion: nil)
}
}
幫助非常感謝。
@property in swift? :/ –
對不起,我會編輯。 – vladiulianbogdan
完成。讓我知道如果這是你想要的。 – vladiulianbogdan