Skip to content
Snippets Groups Projects
Commit a0ce85ca authored by Christophe Geuzaine's avatar Christophe Geuzaine
Browse files

fix missing update

parent f6c2be3f
No related branches found
No related tags found
No related merge requests found
...@@ -147,37 +147,38 @@ ...@@ -147,37 +147,38 @@
if(numbers.size() < 1) return; if(numbers.size() < 1) return;
UIAlertController *alertController; UIAlertController *alertController;
UIAlertAction *destroyAction; UIAlertAction *destroyAction;
alertController = [UIAlertController alertControllerWithTitle:nil message:nil preferredStyle:UIAlertControllerStyleActionSheet]; alertController = [UIAlertController alertControllerWithTitle:nil message:nil preferredStyle:UIAlertControllerStyleActionSheet];
std::vector<double> choices = numbers[0].getChoices(); std::vector<double> choices = numbers[0].getChoices();
for(int i=0;i<choices.size();i++) for(unsigned int i = 0; i < choices.size(); i++)
[alertController addAction:[UIAlertAction actionWithTitle:[NSString stringWithFormat:@"%s", numbers[0].getValueLabel(choices[i]).c_str()] [alertController addAction:[UIAlertAction actionWithTitle:[NSString stringWithFormat:@"%s", numbers[0].getValueLabel(choices[i]).c_str()]
style:UIAlertActionStyleDefault style:UIAlertActionStyleDefault
handler:^(UIAlertAction *action) { handler:^(UIAlertAction *action) {
std::cout << numbers[0].getValueLabel(i).c_str() << std::endl; std::cout << numbers[0].getValueLabel(i).c_str() << std::endl;
[self updateNumber:numbers[0] withValue:i]; [self updateNumber:numbers[0] withValue:i];
[button setTitle:[NSString stringWithFormat:@"%s", numbers[0].getValueLabel(i).c_str()] forState:UIControlStateNormal];
[button setTitle:[NSString stringWithFormat:@"%s", numbers[0].getValueLabel(i).c_str()] forState:UIControlStateNormal];
}]]; }]];
destroyAction = [UIAlertAction actionWithTitle:@"Cancel"
style:UIAlertActionStyleDestructive destroyAction = [UIAlertAction actionWithTitle:@"Cancel"
handler:^(UIAlertAction *action) { style:UIAlertActionStyleDestructive
// do nothing handler:^(UIAlertAction *action) {
}]; // do nothing
[alertController addAction:destroyAction]; }];
[alertController setModalPresentationStyle:UIModalPresentationPopover];
[alertController addAction:destroyAction];
UIPopoverPresentationController *popPresenter = [alertController [alertController setModalPresentationStyle:UIModalPresentationPopover];
popoverPresentationController];
popPresenter.sourceView = button; UIPopoverPresentationController *popPresenter = [alertController popoverPresentationController];
popPresenter.sourceRect = button.bounds; popPresenter.sourceView = button;
[[Utils traverseResponderChainForUIViewController:button] presentViewController:alertController animated:YES completion:nil]; // FIXME traverseResponderChainForUIViewController is a goo idea ?? popPresenter.sourceRect = button.bounds;
// FIXME: is traverseResponderChainForUIViewController a good idea?
[[Utils traverseResponderChainForUIViewController:button] presentViewController:alertController animated:YES completion:nil];
} }
-(void) updateNumber: (onelab::number)n withValue:(double)v -(void) updateNumber: (onelab::number)n withValue:(double)v
{ {
n.setValue(v); n.setValue(v);
onelab::server::instance()->set(n); onelab::server::instance()->set(n);
[super editValue];
} }
-(void)refresh -(void)refresh
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment