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