UIAlertView中的UITextField
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了UIAlertView中的UITextField相关的知识,希望对你有一定的参考价值。
- (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]; }
以上是关于UIAlertView中的UITextField的主要内容,如果未能解决你的问题,请参考以下文章