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 - Unable to make sub reports with Jasper -

scala - play framework: Modules were resolved with conflicting cross-version suffixes -

Passing Variables from AngelScript to C++ -