Skip to content
Snippets Groups Projects
Commit 3b32d72e authored by Maxime Graulich's avatar Maxime Graulich
Browse files

Add UITextFieldDelegate in PostProcessingViewController

parent 4f8dc340
No related branches found
No related tags found
No related merge requests found
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
#include <gmsh/PViewData.h> #include <gmsh/PViewData.h>
#include <gmsh/PViewOptions.h> #include <gmsh/PViewOptions.h>
@interface PostProcessingViewController : UIViewController <UIPickerViewDataSource, UIPickerViewDelegate> @interface PostProcessingViewController : UIViewController <UIPickerViewDataSource, UIPickerViewDelegate, UITextFieldDelegate>
{ {
@private @private
PView *_pview; PView *_pview;
......
...@@ -39,6 +39,15 @@ ...@@ -39,6 +39,15 @@
[_IntervalsType setDelegate:self]; [_IntervalsType setDelegate:self];
[_IntervalsType selectRow:_pview->getOptions()->intervalsType-1 inComponent:0 animated:YES]; [_IntervalsType selectRow:_pview->getOptions()->intervalsType-1 inComponent:0 animated:YES];
[_Intervals setText:[NSString stringWithFormat:@"%d",_pview->getOptions()->nbIso]]; [_Intervals setText:[NSString stringWithFormat:@"%d",_pview->getOptions()->nbIso]];
UIToolbar* numberToolbar = [[UIToolbar alloc]initWithFrame:CGRectMake(0, 0, 320, 50)];
numberToolbar.barStyle = UIBarStyleBlackTranslucent;
numberToolbar.items = [NSArray arrayWithObjects:
[[UIBarButtonItem alloc]initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:nil],
[[UIBarButtonItem alloc]initWithTitle:@"Done" style:UIBarButtonItemStyleDone target:self action:@selector(doneWithNumberPad)],
nil];
[numberToolbar sizeToFit];
_Intervals.delegate = self;
_Intervals.inputAccessoryView = numberToolbar;
[_RaiseZ setValue:_pview->getOptions()->raise[2]]; [_RaiseZ setValue:_pview->getOptions()->raise[2]];
[_RaiseZ addTarget:self action:@selector(slideRaiseZ:) forControlEvents:UIControlEventValueChanged]; [_RaiseZ addTarget:self action:@selector(slideRaiseZ:) forControlEvents:UIControlEventValueChanged];
} }
...@@ -74,6 +83,22 @@ ...@@ -74,6 +83,22 @@
// Dispose of any resources that can be recreated. // Dispose of any resources that can be recreated.
} }
-(BOOL)textFieldShouldEndEditing:(UITextField *)textField
{
_pview->getOptions()->nbIso = [textField.text integerValue];
_pview->setChanged(true);
[[NSNotificationCenter defaultCenter] postNotificationName:@"requestRender" object:nil];
return YES;
}
-(BOOL)textFieldShouldReturn:(UITextField *)textField
{
return [_Intervals endEditing:YES];
}
-(void)doneWithNumberPad
{
[_Intervals endEditing:YES];
}
- (void)viewDidUnload { - (void)viewDidUnload {
[self setName:nil]; [self setName:nil];
[self setIntervalsType:nil]; [self setIntervalsType:nil];
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment