Revision: 32429
Updated Code
at September 24, 2010 14:40 by zpasternack
Updated Code
- (void) doAlertWithTextField {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Congratulations!" message:@"You earned a top score! Enter your name:nn"
delegate:self
cancelButtonTitle:nil
otherButtonTitles:@"OK", nil];
alert.tag = kTag_EnterNameAlert;
CGRect entryFieldRect = CGRectZero;
if( UIDeviceOrientationIsPortrait( [UIApplication sharedApplication].statusBarOrientation ) ) {
entryFieldRect = CGRectMake(12, 90, 260, 25);
}
else {
entryFieldRect = CGRectMake(12, 72, 260, 25);
}
UITextField *nameEntryField = [[UITextField alloc] initWithFrame:entryFieldRect];
nameEntryField.tag = kTag_NameEmtryField;
nameEntryField.backgroundColor = [UIColor whiteColor];
nameEntryField.keyboardType = UIKeyboardTypeAlphabet;
nameEntryField.keyboardAppearance = UIKeyboardAppearanceAlert;
nameEntryField.autocorrectionType = UITextAutocorrectionTypeNo;
nameEntryField.clearButtonMode = UITextFieldViewModeWhileEditing;
[alert addSubview:nameEntryField];
[nameEntryField becomeFirstResponder];
[nameEntryField release];
[alert show];
[alert release];
}
Revision: 32428
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at September 24, 2010 14:39 by zpasternack
Initial Code
<blockquote>
- (void) doAlertWithTextField {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Congratulations!"
message:@"You earned a top score! Enter your name:nn"
delegate:self
cancelButtonTitle:nil
otherButtonTitles:@"OK", nil];
alert.tag = kTag_EnterNameAlert;
CGRect entryFieldRect = CGRectZero;
if( UIDeviceOrientationIsPortrait( [UIApplication sharedApplication].statusBarOrientation ) ) {
entryFieldRect = CGRectMake(12, 90, 260, 25);
}
else {
entryFieldRect = CGRectMake(12, 72, 260, 25);
}
UITextField *nameEntryField = [[UITextField alloc] initWithFrame:entryFieldRect];
nameEntryField.tag = kTag_NameEmtryField;
nameEntryField.backgroundColor = [UIColor whiteColor];
nameEntryField.keyboardType = UIKeyboardTypeAlphabet;
nameEntryField.keyboardAppearance = UIKeyboardAppearanceAlert;
nameEntryField.autocorrectionType = UITextAutocorrectionTypeNo;
nameEntryField.clearButtonMode = UITextFieldViewModeWhileEditing;
[alert addSubview:nameEntryField];
[nameEntryField becomeFirstResponder];
[nameEntryField release];
[alert show];
[alert release];
}
</blockquote>
Initial URL
Initial Description
Initial Title
UITextField in UIAlertView
Initial Tags
iphone
Initial Language
Objective C