/ Published in: Objective C
                    
                                        
                            
                                Expand |
                                Embed | Plain Text
                            
                        
                        Copy this code and paste it in your HTML
- (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];
}
Comments
 Subscribe to comments
                    Subscribe to comments
                
                