key value observing - UITableView reloads row with unwanted fade when previous section is hidden -


i have uitableviewcontroller displays properties of nsmanagedobject in grouped tableview. values of properties can changed custom uitableviewcell subclasses have uisteppers , uitextfields. table has 9 sections, when of nsmanagedobject's properties nil, hide sections setting numberofrowsinsection 0, heightforheaderinsection , heightforfooterinsection 1. works fine; sections hidden.

the custom cells call delegate method changes nsmanagedobject's property values, , uitableviewcontroller set kvo observe properties of nsmanagedobject, , reload individual rows when corresponding properties change. here's beginning of method:

#define position 3 #define targeted_by 5  - (void)observevalueforkeypath:(nsstring *)keypath ofobject:(id)object change:(nsdictionary *)change context:(void *)context {     if ([keypath isequaltostring:@"positionx"]) {         [self.tableview reloadrowsatindexpaths:[nsarray arraywithobject:[nsindexpath indexpathforrow:0 insection:position]]                               withrowanimation:uitableviewrowanimationnone];      } else if ([keypath isequaltostring:@"positiony"]) {         [self.tableview reloadrowsatindexpaths:[nsarray arraywithobject:[nsindexpath indexpathforrow:1 insection:position]]                               withrowanimation:uitableviewrowanimationnone];      } else if ([keypath isequaltostring:@"istargetedby"]) {         [self.tableview reloadsections:[nsindexset indexsetwithindex:targeted_by]                       withrowanimation:uitableviewrowanimationnone];        } } 

it's not complete method properties, idea.

the problem: when i've hidden section above properties, , change value of positionx, cell @ row 0 (the correct positionx cell) reloads not uitableviewrowanimationnone, appears uitableviewrowanimationfade. moves, , don't want to. subclass directly uitableviewcontroller, , there's no other method in class reloads rows or sections other -rowanimationnone. , when try reload whole section no animation, whole section animates. none of other rows in section behave this; reload correctly, no animation. , row 0 reloads no animation when section above not hidden.

i can work around calling [self.tableview reloaddata], i'd rather not way, sake of time , hackiness. have idea how prevent behavior?

this can complicated when many sections involved. think you're trying replicate free sensible tableview framework does. framework automatically generate sections based on managed object's data, , can determine sections make visible based on own rules. worth checking out save tons of time trying reinvent this.


Comments

Popular posts from this blog

Receive udp packets in android gstreamer -

php - Extract Text from HTTP referer -

matplotlib - PYTHON: Annotate boxes disapear dependant on range -