aboutsummaryrefslogtreecommitdiffhomepage
path: root/experimental/iOSSampleApp/Shared/SkAlertPrompt.m
blob: be0adf520b326a437669dad4fdad41b3a86b3ddf (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
//
//  SkAlertPrompt.m
//  iOSSampleApp
//
//  Created by Yang Su on 7/6/11.
//  Copyright 2011 Google Inc.
//  Use of this source code is governed by a BSD-style license that can be
//  found in the LICENSE file.
//

#import "SkAlertPrompt.h"

@implementation SkAlertPrompt
@synthesize textField;

- (id)initWithTitle:(NSString *)title
            message:(NSString *)message
           delegate:(id)delegate
  cancelButtonTitle:(NSString *)cancelButtonTitle
     otherButtonTitles:(NSString *)okayButtonTitle,... {
    if (self = [super initWithTitle:title
                            message:message
                           delegate:delegate
                  cancelButtonTitle:cancelButtonTitle
                  otherButtonTitles:okayButtonTitle, nil]) {
        self.textField = [[UITextField alloc]
                          initWithFrame:CGRectMake(12, 45, 260, 25)];
        [self.textField setBackgroundColor:[UIColor whiteColor]];
        textField.borderStyle = UITextBorderStyleLine;
        [self addSubview:self.textField];
    }
    return self;
}

- (void)show {
    [textField becomeFirstResponder];
    [super show];
}

- (NSString *)enteredText {
    return textField.text;
}

- (void)dealloc {
    [textField release];
    [super dealloc];
}

@end