From 294d2518a027602a7dc495279f3a5fcf9e1bb127 Mon Sep 17 00:00:00 2001 From: Maxime Graulich <maxime.graulich@gmail.com> Date: Wed, 19 Mar 2014 10:27:14 +0000 Subject: [PATCH] iOS: fix alert on error --- contrib/mobile/iOS/Onelab/ModelViewController.mm | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/contrib/mobile/iOS/Onelab/ModelViewController.mm b/contrib/mobile/iOS/Onelab/ModelViewController.mm index 30e4c7d216..b92818a409 100644 --- a/contrib/mobile/iOS/Onelab/ModelViewController.mm +++ b/contrib/mobile/iOS/Onelab/ModelViewController.mm @@ -318,12 +318,16 @@ -(void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex { - if(buttonIndex == 0) [_errors removeAllObjects]; - else [_errors removeLastObject]; - if(_errors.count > 0) { - //[_errorAlert setMessage:[_errors lastObject]]; - [_errorAlert show]; + if(buttonIndex == 0) { + [_errors removeAllObjects]; + return; } + else [_errors removeLastObject]; + if(_errors.count > 1) + _errorAlert = [[UIErrorAlertView alloc] initWithTitle:@"Gmsh/GetDP error" message:[_errors lastObject] delegate:self cancelButtonTitle:@"Hide" otherButtonTitles:@"Show more", nil]; + else + _errorAlert = [[UIErrorAlertView alloc] initWithTitle:@"Gmsh/GetDP error" message:[_errors lastObject] delegate:self cancelButtonTitle:@"Hide" otherButtonTitles: nil]; + [_errorAlert show]; } #pragma mark - Split view -- GitLab