Mon tableView ne se chargeait pas car tableView:cellForRowAtIndexPath:
n'était pas appelé. Les messages NSLog
que j'ai écrits à l'intérieur tableView:cellForRowAtIndexPath:
n'apparaissaient pas dans la console. J'avais un weak
NSArray @property appelé listOfItems. Quand je l'ai changé à strong
, la tableView a finalement montré son contenu. Est-ce que quelqu'un pourrait clarifier si tableView:cellForRowAtIndexPath:
n'était pas appelé parce que NSArray était faible. Y at-il un lien entre la propriété listOfItems
et la méthode tableView:cellForRowAtIndexPath:
appelée?tableView: cellForRowAtIndexPath: non appelé car le tableau est vide?
Répondre
Aucun objet ne faisait référence au tableau. Votre contrôleur de vue avait une référence, mais ce n'était pas fort. Cela signifie que vous ne vous en souciez pas si vous l'enlevez de la mémoire, vous n'en avez pas besoin pour rester. Dans ce cas, puisque votre table s'appuie sur les données du tableau, vous ne voulez pas qu'elles soient supprimées de la mémoire: vous voulez qu'elles restent aussi longtemps que la table reste. Pour ce faire, vous créez une référence forte, qui s'assure que cet objet n'est pas retiré de la mémoire jusqu'à ce pointeur (votre propriété, dans ce cas) ne pointe plus vers lui.
Belle description, +1 –
- 1. tableView cellForRowAtIndexPath appelé plusieurs fois initialement
- 2. TableView cellForRowAtIndexPath n'est jamais appelé (iOS, Swift)
- 3. UITableView cellforrowatindexpath pas appelé
- 4. Quand cellForRowAtIndexPath est-il appelé?
- 5. cellForRowAtIndexPath n'est jamais appelé
- 6. cellForRowAtIndexPath appelé trop tard
- 7. Comment tableView: cellForRowAtIndexPath: est censé être utilisé?
- 8. cellForRowAtIndexPath pas appelé
- 9. quand est-ce appelé: - (UITableViewCell *) tableView: (UITableView *) tableView cellForRowAtIndexPath: (NSIndexPath *) indexPath
- 10. numberOfRowsInSection appelé mais cellForRowAtIndexPath pas appelé
- 11. Ce qui appelle tableView: cellForRowAtIndexPath
- 12. Problème de source de données UITableView. Mon tableau de données est soudainement vide lorsque UITableView: cellForRowAtIndexPath: est appelé
- 13. Que devrait renvoyer cellForRowAtIndexPath si la table est vide?
- 14. tableView: cellForRowAtIndexPath: méthode question
- 15. Tableview créé est vide
- 16. tableView: viewForTableColumn: row: non appelé
- 17. UITableView cellForRowAtIndexPath parfois pas appelé?
- 18. insertRowsAtIndexPath de tableView n'appelle pas cellForRowAtIndexPath
- 19. cellForRowAtIndexPath n'est pas appelé après reloadRowsAtIndexPaths
- 20. Arrêtez l'échec de Tableview lorsque le tableau est vide?
- 21. EXC_BAD_ACCESS (SIGSEGV) sur tableView: cellForRowAtIndexPath
- 22. Obtenir tableView: heightForRowAtIndexPath: se produire après tableView: cellForRowAtIndexPath:?
- 23. cellForRowAtIndexPath non appelé à partir des délégués UISearchDisplayController
- 24. Personnaliser Vide TableView
- 25. -tableView: cellForRowAtIndexPath: ne se fait pas appeler
- 26. tableau est vide après avoir appelé la méthode
- 27. RootViewController - tableView: cellForRowAtIndexPath - Charger l'image de assetsLibrary
- 28. cellForRowAtIndexPath et numberOfRowsInSection en conflit dans tableView
- 29. Est-ce que heightForRowAtIndexPath est appelé avant cellForRowAtIndexPath?
- 30. cellForRowAtIndexPath insertion dans le tableau
pouvez-vous poster la méthode '' numberOfSectionsInTableView: ''? –
Je pense que vous voulez dire numberOfRows, et même ainsi, ce serait sans importance. –
pouvez-vous le poster pour moi? Je veux savoir comment faites-vous le '' numberOfRowsInTableView'' parce que j'ai le même problème une fois et l'erreur était int '' numberOfRowsInTableView'' –