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:
- add notification in aviewcontroller
- post notification in bviewcontroller parameter (selected cell's indexpath)
- 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
Post a Comment