ios - What will happen when I scroll up and down UITableView because it's related to a bug I am trying to figure it out -


i want know happen when scroll uitableview , down. because facing bug related this. situation this, when click button, cell's avaudioplayer play audio url, , when scroll table view , down, view freeze. don't know what's caused this. trying figure out.

according dequeuereusablecellwithidentifier: documentation:

for performance reasons, table view’s data source should reuse uitableviewcell objects when assigns cells rows in tableview:cellforrowatindexpath: method. table view maintains queue or list of uitableviewcell objects data source has marked reuse. call method data source object when asked provide new cell table view. method dequeues existing cell if 1 available or creates new 1 using class or nib file registered. if no cell available reuse , did not register class or nib file, method returns nil.

that means:

when cell disappears , cell b appears , have same identifier, uikit reuse cell , returned dequeuereusablecellwithidentifier: call. if there no cell reuse - create new one.

you can use prepareforreuse method handle/prepare cell reuse.

if play audio avaudioplayer, define property in uitableviewcontroller. not create avaudioplayer object each cell.


Comments

Popular posts from this blog

c - Bitwise operation with (signed) enum value -

xslt - Unnest parent nodes by child node -

YouTubePlayerFragment cannot be cast to android.support.v4.app.Fragment -