From 9364966a041cd85a3ee4ff9c70324446a46a6414 Mon Sep 17 00:00:00 2001 From: Paul Gardiner Date: Tue, 7 Jan 2014 12:23:58 +0000 Subject: iOS: update the form filling dialogs to avoid the keyboard hiding the buttons Also bring up the keyboard automatically --- platform/ios/Classes/MuChoiceFieldController.h | 3 - platform/ios/Classes/MuChoiceFieldController.m | 12 +- platform/ios/Classes/MuChoiceFieldController.xib | 688 ++--------------------- platform/ios/Classes/MuTextFieldController.h | 3 - platform/ios/Classes/MuTextFieldController.m | 14 +- platform/ios/Classes/MuTextFieldController.xib | 666 ++-------------------- 6 files changed, 119 insertions(+), 1267 deletions(-) (limited to 'platform/ios/Classes') diff --git a/platform/ios/Classes/MuChoiceFieldController.h b/platform/ios/Classes/MuChoiceFieldController.h index d99f8cd5..a9742282 100644 --- a/platform/ios/Classes/MuChoiceFieldController.h +++ b/platform/ios/Classes/MuChoiceFieldController.h @@ -13,8 +13,5 @@ NSArray *choices; int selected; } -@property (retain, nonatomic) IBOutlet UIPickerView *picker; - (id)initWithChoices:(NSArray *)choices okayAction:(void (^)(NSArray *))block; -- (IBAction)okayTapped:(id)sender; -- (IBAction)cancelTapped:(id)sender; @end diff --git a/platform/ios/Classes/MuChoiceFieldController.m b/platform/ios/Classes/MuChoiceFieldController.m index d32383b6..d4806dbf 100644 --- a/platform/ios/Classes/MuChoiceFieldController.m +++ b/platform/ios/Classes/MuChoiceFieldController.m @@ -8,7 +8,9 @@ #import "MuChoiceFieldController.h" @interface MuChoiceFieldController () - +- (IBAction)onCancel:(id)sender; +- (IBAction)onOkay:(id)sender; +@property (retain, nonatomic) IBOutlet UIPickerView *picker; @end @implementation MuChoiceFieldController @@ -20,7 +22,7 @@ { okayBlock = Block_copy(block); choices = [_choices retain]; - selected = -1; + selected = 0; } return self; } @@ -67,14 +69,14 @@ selected = row; } -- (IBAction)okayTapped:(id)sender +- (IBAction)onOkay:(id)sender { - if (selected > -1) + if (selected >= 0 && selected < [choices count]) okayBlock([NSArray arrayWithObject:[choices objectAtIndex:selected]]); [self dismissViewControllerAnimated:YES completion:nil]; } -- (IBAction)cancelTapped:(id)sender +- (IBAction)onCancel:(id)sender { [self dismissViewControllerAnimated:YES completion:nil]; } diff --git a/platform/ios/Classes/MuChoiceFieldController.xib b/platform/ios/Classes/MuChoiceFieldController.xib index 0b225782..8ec37dcf 100644 --- a/platform/ios/Classes/MuChoiceFieldController.xib +++ b/platform/ios/Classes/MuChoiceFieldController.xib @@ -1,639 +1,49 @@ - - - - 1552 - 11G63b - 3084 - 1138.51 - 569.00 - - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - 2083 - - - IBNSLayoutConstraint - IBProxyObject - IBUIButton - IBUILabel - IBUIPickerView - IBUIView - - - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - - PluginDependencyRecalculationVersion - - - - - IBFilesOwner - IBCocoaTouchFramework - - - IBFirstResponder - IBCocoaTouchFramework - - - - 274 - - - - 292 - {{20, 47}, {281, 21}} - - - - _NS:9 - NO - YES - 7 - NO - IBCocoaTouchFramework - Choose value - - 3 - MQA - - - 0 - 1 - - 1 - 17 - - - Helvetica - 17 - 16 - - NO - - - - 292 - {{20, 416}, {280, 44}} - - - - _NS:9 - NO - IBCocoaTouchFramework - 0 - 0 - 1 - Okay - - - 1 - MC4xOTYwNzg0MzQ2IDAuMzA5ODAzOTMyOSAwLjUyMTU2ODY1NgA - - - 3 - MC41AA - - - 2 - 15 - - - Helvetica-Bold - 15 - 16 - - - - - 292 - {{20, 476}, {281, 44}} - - - _NS:9 - NO - IBCocoaTouchFramework - 0 - 0 - 1 - Cancel - - - 1 - MC4xOTYwNzg0MzQ2IDAuMzA5ODAzOTMyOSAwLjUyMTU2ODY1NgA - - - - - - - - 290 - {{20, 119}, {280, 216}} - - - - _NS:9 - IBCocoaTouchFramework - YES - - - {{0, 20}, {320, 548}} - - - - - 3 - MC4zMzMzMzMzMzMzAA - - - - IBUIScreenMetrics - - YES - - - - - - {320, 568} - {568, 320} - - - IBCocoaTouchFramework - Retina 4 Full Screen - 2 - - IBCocoaTouchFramework - - - - - - - view - - - - 3 - - - - picker - - - - 87 - - - - okayTapped: - - - 7 - - 88 - - - - cancelTapped: - - - 7 - - 89 - - - - - - 0 - - - - - - 1 - - - - - 5 - 0 - - 5 - 1 - - 20 - - 1000 - - 8 - 29 - 3 - - - - 4 - 0 - - 4 - 1 - - 29 - - 1000 - - 3 - 9 - 3 - - - - 4 - 0 - - 4 - 1 - - 89 - - 1000 - - 3 - 9 - 3 - - - - 9 - 0 - - 9 - 1 - - 0.0 - - 1000 - - 6 - 24 - 2 - - - - 6 - 0 - - 6 - 1 - - 20 - - 1000 - - 8 - 29 - 3 - - - - 5 - 0 - - 5 - 1 - - 20 - - 1000 - - 8 - 29 - 3 - - - - 6 - 0 - - 6 - 1 - - 20 - - 1000 - - 8 - 29 - 3 - - - - 5 - 0 - - 5 - 1 - - 20 - - 1000 - - 8 - 29 - 3 - - - - 3 - 0 - - 3 - 1 - - 119 - - 1000 - - 3 - 9 - 3 - - - - 6 - 0 - - 6 - 1 - - 0.0 - - 1000 - - 6 - 24 - 2 - - - - 3 - 0 - - 3 - 1 - - 47 - - 1000 - - 3 - 9 - 3 - - - - 5 - 0 - - 5 - 1 - - 20 - - 1000 - - 8 - 29 - 3 - - - - - - - - - - -1 - - - File's Owner - - - -2 - - - - - 4 - - - - - - 11 - - - - - 22 - - - - - - 41 - - - - - 48 - - - - - 49 - - - - - 59 - - - - - - 60 - - - - - 62 - - - - - 64 - - - - - 68 - - - - - 73 - - - - - 74 - - - - - 8 - 0 - - 0 - 1 - - 216 - - 1000 - - 3 - 9 - 1 - - - - - - 76 - - - - - 83 - - - - - 81 - - - - - 82 - - - - - - - MuChoiceFieldController - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - UIResponder - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - - - - - - - - - - - - - - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - - - - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - - - - - 89 - - - - - MuChoiceFieldController - UIViewController - - id - id - - - - cancelTapped: - id - - - okayTapped: - id - - - - picker - UIPickerView - - - picker - - picker - UIPickerView - - - - IBProjectSource - ./Classes/MuChoiceFieldController.h - - - - NSLayoutConstraint - NSObject - - IBProjectSource - ./Classes/NSLayoutConstraint.h - - - - - 0 - IBCocoaTouchFramework - YES - 3 - YES - 2083 - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/platform/ios/Classes/MuTextFieldController.h b/platform/ios/Classes/MuTextFieldController.h index f74f0610..1783bc08 100644 --- a/platform/ios/Classes/MuTextFieldController.h +++ b/platform/ios/Classes/MuTextFieldController.h @@ -12,8 +12,5 @@ void (^okayBlock)(NSString *); NSString *initialText; } -@property (retain, nonatomic) IBOutlet UITextView *textView; - (id)initWithText:(NSString *)text okayAction:(void (^)(NSString *))block; -- (IBAction)okayTapped:(id)sender; -- (IBAction)cancelTapped:(id)sender; @end diff --git a/platform/ios/Classes/MuTextFieldController.m b/platform/ios/Classes/MuTextFieldController.m index 45e53054..0d978486 100644 --- a/platform/ios/Classes/MuTextFieldController.m +++ b/platform/ios/Classes/MuTextFieldController.m @@ -8,6 +8,11 @@ #import "MuTextFieldController.h" @interface MuTextFieldController () +@property (retain, nonatomic) IBOutlet UINavigationBar *navBar; +- (IBAction)onCancel:(id)sender; +- (IBAction)onOkay:(id)sender; +@property (retain, nonatomic) IBOutlet UITextView *textView; + @end @implementation MuTextFieldController @@ -27,32 +32,31 @@ { [super viewDidLoad]; _textView.text = initialText; - // Do any additional setup after loading the view from its nib. + [_textView becomeFirstResponder]; } - (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; - // Dispose of any resources that can be recreated. } - (void)dealloc { [okayBlock release]; [initialText release]; + [_navBar release]; [_textView release]; [super dealloc]; } -- (IBAction)okayTapped:(id)sender +- (IBAction)onOkay:(id)sender { okayBlock(_textView.text); [self dismissViewControllerAnimated:YES completion:nil]; } -- (IBAction)cancelTapped:(id)sender +- (IBAction)onCancel:(id)sender { [self dismissViewControllerAnimated:YES completion:nil]; } - @end diff --git a/platform/ios/Classes/MuTextFieldController.xib b/platform/ios/Classes/MuTextFieldController.xib index 298e1508..cf59cf01 100644 --- a/platform/ios/Classes/MuTextFieldController.xib +++ b/platform/ios/Classes/MuTextFieldController.xib @@ -1,612 +1,54 @@ - - - - 1552 - 11G63b - 3084 - 1138.51 - 569.00 - - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - 2083 - - - IBNSLayoutConstraint - IBProxyObject - IBUIButton - IBUILabel - IBUITextView - IBUIView - - - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - - PluginDependencyRecalculationVersion - - - - - IBFilesOwner - IBCocoaTouchFramework - - - IBFirstResponder - IBCocoaTouchFramework - - - - 274 - - - - 292 - {{20, 47}, {281, 21}} - - - _NS:9 - NO - YES - 7 - NO - IBCocoaTouchFramework - Fill in text field - - 3 - MQA - - - 0 - 1 - - 1 - 17 - - - Helvetica - 17 - 16 - - NO - - - - 292 - {{20, 89}, {281, 281}} - - - _NS:9 - - 1 - MSAxIDEAA - - YES - YES - IBCocoaTouchFramework - - - 2 - IBCocoaTouchFramework - - - Helvetica - Helvetica - 0 - 14 - - - Helvetica - 14 - 16 - - - - - 292 - {{20, 416}, {280, 44}} - - - _NS:9 - NO - IBCocoaTouchFramework - 0 - 0 - 1 - Okay - - - 1 - MC4xOTYwNzg0MzQ2IDAuMzA5ODAzOTMyOSAwLjUyMTU2ODY1NgA - - - 3 - MC41AA - - - 2 - 15 - - - Helvetica-Bold - 15 - 16 - - - - - 292 - {{20, 476}, {281, 44}} - - - _NS:9 - NO - IBCocoaTouchFramework - 0 - 0 - 1 - Cancel - - - 1 - MC4xOTYwNzg0MzQ2IDAuMzA5ODAzOTMyOSAwLjUyMTU2ODY1NgA - - - - - - - {{0, 20}, {320, 548}} - - - - 3 - MC4zMzMzMzMzMzMzAA - - - - IBUIScreenMetrics - - YES - - - - - - {320, 568} - {568, 320} - - - IBCocoaTouchFramework - Retina 4 Full Screen - 2 - - IBCocoaTouchFramework - - - - - - - view - - - - 3 - - - - textView - - - - 70 - - - - okayTapped: - - - 7 - - 71 - - - - cancelTapped: - - - 7 - - 72 - - - - - - 0 - - - - - - 1 - - - - - 5 - 0 - - 5 - 1 - - 20 - - 1000 - - 8 - 29 - 3 - - - - 4 - 0 - - 4 - 1 - - 29 - - 1000 - - 3 - 9 - 3 - - - - 4 - 0 - - 4 - 1 - - 89 - - 1000 - - 3 - 9 - 3 - - - - 9 - 0 - - 9 - 1 - - 0.0 - - 1000 - - 6 - 24 - 2 - - - - 6 - 0 - - 6 - 1 - - 20 - - 1000 - - 8 - 29 - 3 - - - - 5 - 0 - - 5 - 1 - - 20 - - 1000 - - 8 - 29 - 3 - - - - 3 - 0 - - 3 - 1 - - 89 - - 1000 - - 3 - 9 - 3 - - - - 6 - 0 - - 6 - 1 - - 0.0 - - 1000 - - 6 - 24 - 2 - - - - 6 - 0 - - 6 - 1 - - 0.0 - - 1000 - - 6 - 24 - 2 - - - - 5 - 0 - - 5 - 1 - - 20 - - 1000 - - 8 - 29 - 3 - - - - 3 - 0 - - 3 - 1 - - 47 - - 1000 - - 3 - 9 - 3 - - - - 5 - 0 - - 5 - 1 - - 20 - - 1000 - - 8 - 29 - 3 - - - - - - - - - - -1 - - - File's Owner - - - -2 - - - - - 4 - - - - - - 11 - - - - - 12 - - - - - 8 - 0 - - 0 - 1 - - 281 - - 1000 - - 3 - 9 - 1 - - - - - - 21 - - - - - 22 - - - - - - 41 - - - - - 43 - - - - - 48 - - - - - 49 - - - - - 54 - - - - - 59 - - - - - - 60 - - - - - 62 - - - - - 64 - - - - - 65 - - - - - 68 - - - - - 69 - - - - - - - MuTextFieldController - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - UIResponder - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - - - - - - - - - - - - - - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - - - - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - - - - - 72 - - - 0 - IBCocoaTouchFramework - YES - 3 - YES - 2083 - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file -- cgit v1.2.3