skia2/experimental/iOSSampleApp/Shared/SkAlertPrompt.m
2011-07-17 14:42:08 +00:00

48 lines
1.2 KiB
Objective-C

//
// SkAlertPrompt.m
// iOSSampleApp
//
// Created by Yang Su on 7/6/11.
// Copyright 2011 Google Inc. All rights reserved.
//
#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