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
#import "SampleApp.h"

@implementation SampleApp

- (void) applicationDidFinishLaunching: (id) unused
{
    UIWindow *window;
    struct CGRect rect = [UIHardware fullScreenApplicationContentRect];
    rect.origin.x = rect.origin.y = 0.0f;

    window = [[UIWindow alloc] initWithContentRect: rect];

    [window orderFront: self];
    [window makeKey: self];
    [window _setHidden: NO];

    mainView = [[UIView alloc] initWithFrame: rect];

    textView = [[UITextView alloc] 
        initWithFrame: CGRectMake(0.0f, 0.0f, 320.0f, 240.0f)];
    [textView setEditable:YES];
    [textView setTextSize:14];

    kb = [[UIKeyboard alloc] 
        initWithFrame:CGRectMake(0.0f, 245.0f, 320.0f, 200.0f)];

    [window setContentView: mainView];
    [mainView addSubview:textView];
    [mainView addSubview:kb];

    path = @"/var/root/.s1text";

    [textView setText:
        [NSMutableString 
            stringWithContentsOfFile:path
	    encoding:NSMacOSRomanStringEncoding
	    error:&error]];
}

- (void) applicationWillSuspend
{
   [[textView text]
	writeToFile: path 
	atomically: NO 
	encoding: NSMacOSRomanStringEncoding
	error: &error];
}

@end