blob: e0864ff47cba5c1eaa2fe710c551d8ac4929210b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
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
|