Я подталкиваю otherUserUid и otherUserFullName другому контроллеру представления, но он не является вызовом немедленно. Информация отстает, и для получения информации требуется 2 щелчка.Подготовьтесь к задержке списания. Информация задерживается, но представляется
Я думаю, что prepForSegue: вызывается до didSelectRowAtIndexPath: любые решения, как исправить это?
Cheers!
переопределение функ Tableview (Tableview: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
self.performSegueWithIdentifier("jsqDirectory", sender: self)
let indexPath = tableView.indexPathForSelectedRow!
let currentCell = tableView.cellForRowAtIndexPath(indexPath)! as UITableViewCell
self.otherUserFullName = (currentCell.textLabel?.text)!
print(self.otherUserFullName)
self.otherUserUid = (currentCell.detailTextLabel?.text)!
print(self.otherUserUid)
}
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
if segue.identifier == "jsqDirectory" {
if let viewController = segue.destinationViewController as? JSQViewController{
viewController.senderDisplayName = self.fullName
viewController.senderId = self.firebase.authData.uid
viewController.otherUid = self.otherUserUid
viewController.otherUser = self.otherUserFullName
}
}
}
override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCellWithIdentifier("directoryCell") as UITableViewCell!
let directoryItem = items[indexPath.row]
cell.textLabel?.text = directoryItem.fullName
cell.detailTextLabel!.text = directoryItem.key
cell.detailTextLabel!.hidden = true
return cell
}
Спасибо дружище. Это сработало! –
вы выполняли слишком рано, чем передавали значения следующему виду контроллера. обязательно отметьте этот ответ как «Правильно» и «пальцы вверх» –