Skip to content

Commit

Permalink
ORKFormStepViewController: fix crash when re-laying out forms
Browse files Browse the repository at this point in the history
(E.g., ORKTestView's 'Mini Form' crashed on rotation.)
  • Loading branch information
rsanchezsaez committed Oct 21, 2015
1 parent df61cb7 commit 99047fe
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions ResearchKit/Common/ORKFormStepViewController.m
Expand Up @@ -908,8 +908,8 @@ - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPa
cell = [self tableView:tableView cellForRowAtIndexPath:indexPath];
}
if ([cell isKindOfClass:[ORKChoiceViewCell class]]) {
ORKTableCellItem *cellItem = ([_sections[indexPath.section] items][indexPath.row - 1]);
height = [ORKChoiceViewCell suggestedCellHeightForShortText:cellItem.choice.text longText:cellItem.choice.detailText inTableView:_tableView];
ORKTableCellItem *cellItem = _sections[indexPath.section].items[indexPath.row - 1];
height = [ORKChoiceViewCell suggestedCellHeightForShortText:cellItem.choice.text longText:cellItem.choice.detailText inTableView:_tableView];
}
}
return height;
Expand Down Expand Up @@ -1014,7 +1014,7 @@ - (void)decodeRestorableStateWithCoder:(NSCoder *)coder {

- (void)viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id<UIViewControllerTransitionCoordinator>)coordinator {
[super viewWillTransitionToSize:size withTransitionCoordinator:coordinator];
for (ORKFormItemCell *cell in _formItemCells) {
for (ORKFormItemCell *cell in _formItemCells.allValues) {
[cell setExpectedLayoutWidth:size.width];
}
}
Expand Down

0 comments on commit 99047fe

Please sign in to comment.