ios - reload UITableViewCell after push -


in aviewcontroller there uitableview contains data, call

[self.navigationcontroller pushviewcontroller:bviewcontroller animated:yes]

to push bviewcontroller, after doing thing in bviewcontroller, cell selected in aviewcontroller change info(for example update read count).

my solution:

  1. add notification in aviewcontroller
  2. post notification in bviewcontroller parameter (selected cell's indexpath)
  3. when notification bviewcontroller, reload cell of indexpath.

now meet issue:
of time there no problem, sometime app crash, problem is
the cell in aviewcontrller indexpath(get notification posted bviewcontroller)**is invisible.

you can reload whole table view in viewdidappeare method. work every time go bviewcontroller.

or keep performance in mind can reload visible rows:

[tableview reloadrowsatindexpaths:[tableview indexpathsforvisiblerows]                   withrowanimation:uitableviewrowanimationnone]; 

or reload 1 cell made changes, replace [tableview indexpathsforvisiblerows] array contains 1 index path of cell want reload.


Comments

Popular posts from this blog

java - Plugin org.apache.maven.plugins:maven-install-plugin:2.4 or one of its dependencies could not be resolved -

Round ImageView Android -

How can I utilize Yahoo Weather API in android -