I have an object that is being loaded in an async fashion and I cannot guarantee that it will be available by the time objectForSection is called. Is there a recommended approach for this type of situations?

3 replies to this topic
#1
Posted 13 March 2016 - 09:11 PM
#2
Posted 13 March 2016 - 10:13 PM
Hi Radu,
When object loading is asynchronous, you don't implement objectForSection, but rather directly set the section's 'boundObject' property as soon as the object is fetched. Please let me know if you still need help with this.
When object loading is asynchronous, you don't implement objectForSection, but rather directly set the section's 'boundObject' property as soon as the object is fetched. Please let me know if you still need help with this.
#3
Posted 14 March 2016 - 04:28 AM
Hi Tarek,
Thank you for you answer; I have a few questions/remarks on that:
- I'm assuming that's a safe approach, the documentation indicated that 'boundObject' should be used internally only, for subclassing?
- Can you describe the difference between 'boundObject', 'boundValue', and 'boundProperty'?
- And last, is it safe to call that multiple times? Or how would you handle a situation where you load asynchronously most of the object, then load another part of it as a separate asynchronous request (e.g. an image associated with the object)? Would you split that in two requests or would you just wait longer in a single request?
Thank you,
Radu
#4
Posted 15 March 2016 - 09:54 AM
Hi Radu,
Yes it's safe to call multiple times. Once set, the section will regenerate its cells, so you should be refreshing the associated table view to see your changes:
[myObjectSection.ownerTableViewModel.tableView reloadData];
As for the 'internal' label in the docs: as long as it says it's ok to use when subclassing, then it should be fine that you use it yourself
Also tagged with one or more of these keywords: models, sections
Sensible TableView Forum →
STV Sections →
case-insensitive sorting - revisitedStarted by Dennis , 09 Aug 2016 ![]() |
|
![]()
|
||
Sensible TableView Forum →
STV Model →
SCTableModel's boundObject's dealloc method not calledStarted by tommy@ageet , 12 May 2016 ![]() |
|
![]()
|
||
Sensible TableView Forum →
STV Model →
Rearranging the cells of the table and fetching their orderStarted by fabiensen , 27 Apr 2016 ![]() |
|
![]()
|
||
Sensible TableView Forum →
General Discussions →
Can one tableview with a list open another linked tableview with a list in STV?Started by Morten Jacobsen , 01 Jan 2016 ![]() |
|
![]()
|
||
Sensible TableView Forum →
STV Sections →
Crash when setting datasource on SCArrayOfObjectsModelStarted by Dennis , 01 Dec 2015 ![]() |
|
![]()
|
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users