I am trying to find a simple tutorial for inserting custom objects asynchronous on uitableview cells while scrolling because my uitableview does not scroll nicely and smoothly. I have searched but i only have found about images asynchronous loading not helpful. I have an uiview that needs to be loaded asynchronous. Too much processing work is needed before the object loads as a result scrolling is not smooth.
Any help appreciated.
This is not as hard as it seems. There is only one caveat. You must know the height of your cell even when it is not fully loaded.
If the tableView has a constant row height, then set tableView.rowHeight. If you need to determine row height on the fly use UITableViewDelegate’s
–tableView:heightForRowAtIndexPath:callback.Then in
-tableView:cellForRowAtIndexPathdequeue a cell, set it to some initial state, kick off a NSOperation or a GCD block, and finally return the cell that you have reset.In the NSOperation or CCG block you will perform the work you need, then call back into the main thread to set the values into the cell. This is the essence of async cell loading.