diff options
author | Paul Gardiner <paul.gardiner@artifex.com> | 2013-10-14 12:52:48 +0100 |
---|---|---|
committer | Paul Gardiner <paul.gardiner@artifex.com> | 2013-10-16 09:59:35 +0100 |
commit | a0029d70729f0cad0515b7e9fcb55a7527d199a1 (patch) | |
tree | 3ac8086b12c9652fc1652b937831c08fb33cea69 /platform/ios/Classes/MuTextFieldController.m | |
parent | d246518b3f3f64ba10475e5043c554011a383a1c (diff) | |
download | mupdf-a0029d70729f0cad0515b7e9fcb55a7527d199a1.tar.xz |
iOS: support filling in of text form fields
Diffstat (limited to 'platform/ios/Classes/MuTextFieldController.m')
-rw-r--r-- | platform/ios/Classes/MuTextFieldController.m | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/platform/ios/Classes/MuTextFieldController.m b/platform/ios/Classes/MuTextFieldController.m new file mode 100644 index 00000000..e0864ff4 --- /dev/null +++ b/platform/ios/Classes/MuTextFieldController.m @@ -0,0 +1,58 @@ +// +// MuTextFieldController.m +// MuPDF +// +// Copyright (c) 2013 Artifex Software, Inc. All rights reserved. +// + +#import "MuTextFieldController.h" + +@interface MuTextFieldController () +@end + +@implementation MuTextFieldController + +-(id)initWithText:(NSString *)text okayAction:(void (^)(NSString *))block +{ + self = [super initWithNibName:@"MuTextFieldController" bundle:nil]; + if (self) + { + okayBlock = Block_copy(block); + initialText = [text retain]; + } + return self; +} + +- (void)viewDidLoad +{ + [super viewDidLoad]; + _textView.text = initialText; + // Do any additional setup after loading the view from its nib. +} + +- (void)didReceiveMemoryWarning +{ + [super didReceiveMemoryWarning]; + // Dispose of any resources that can be recreated. +} + +- (void)dealloc +{ + [okayBlock release]; + [initialText release]; + [_textView release]; + [super dealloc]; +} + +- (IBAction)okayTapped:(id)sender +{ + okayBlock(_textView.text); + [self dismissViewControllerAnimated:YES completion:nil]; +} + +- (IBAction)cancelTapped:(id)sender +{ + [self dismissViewControllerAnimated:YES completion:nil]; +} + +@end |