Skip to content

Commit b39cea7

Browse files
committed
Dont reload observation edit table view cell on change
* This should stop table view from moving after editing a cell
1 parent 0e4cb2e commit b39cea7

File tree

3 files changed

+8
-10
lines changed

3 files changed

+8
-10
lines changed

Mage/ObservationEditRadioTableViewCell.m

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ - (void) setValid:(BOOL) valid {
9292

9393
if (valid) {
9494
self.valueTextField.layer.borderColor = nil;
95+
self.valueTextField.layer.borderWidth = 0.0f;
9596
} else {
9697
self.valueTextField.layer.cornerRadius = 4.0f;
9798
self.valueTextField.layer.masksToBounds = YES;

Mage/ObservationEditViewController.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ - (void)viewDidLoad {
5858
self.observation.dirty = [NSNumber numberWithBool:YES];
5959
self.editDataStore.observation = self.observation;
6060

61-
[self.editTable setEstimatedRowHeight:65.0f];
61+
[self.editTable setEstimatedRowHeight:50.0f];
6262
[self.editTable setRowHeight:UITableViewAutomaticDimension];
6363
}
6464

Mage/ObservationEditViewDataStore.m

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N
138138

139139
[cell populateCellWithFormField:field andObservation:self.observation];
140140
[cell setValid:![self.invalidIndexPaths containsObject:indexPath]];
141-
141+
142142
return cell;
143143
}
144144

@@ -171,15 +171,12 @@ - (void) observationField:(id)field valueChangedTo:(id)value reloadCell:(BOOL)re
171171
NSInteger row = [[[self fieldToRow] objectForKey:[field objectForKey:@"id"]] integerValue];
172172
NSIndexPath *indexPath = [NSIndexPath indexPathForItem: row inSection:0];
173173

174-
if (reload == YES) {
175-
[self.editTable beginUpdates];
176-
[self.editTable reloadRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationNone];
177-
[self.editTable endUpdates];
178-
}
179-
180-
if ([self.invalidIndexPaths containsObject:indexPath]) {
174+
if (reload == YES || [self.invalidIndexPaths containsObject:indexPath]) {
181175
[self.invalidIndexPaths removeObject:indexPath];
182-
[self.editTable reloadRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationNone];
176+
177+
id cell = [self.editTable cellForRowAtIndexPath:indexPath];
178+
[cell populateCellWithFormField:field andObservation:self.observation];
179+
[cell setValid:![self.invalidIndexPaths containsObject:indexPath]];
183180
}
184181

185182
if ([fieldKey isEqualToString:@"type"] && self.annotationChangedDelegate) {

0 commit comments

Comments
 (0)