【发布时间】:2013-06-22 18:11:55
【问题描述】:
我想构建一个弹出式警报视图,允许用户输入文本输入。我试过下面的代码。
它可以工作,除了我需要更大的文本区域——比如——UITextView。但是,当我使用具有更大 Frame 区域的 UITextView 时。它覆盖了整个 UIAlertView 区域。
您有任何关于如何使用大文本区域 (UITextView) 构建弹出文本输入的示例吗?
UIAlertView* alert = [[UIAlertView alloc] initWithTitle:@"Preset Saving..." message:@"Describe the Preset\n\n\n" delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:@"Ok", nil];
UITextField *textField;
textField = [[UITextField alloc] init];
[textField setBackgroundColor:[UIColor whiteColor]];
textField.delegate = self;
textField.borderStyle = UITextBorderStyleLine;
textField.frame = CGRectMake(15, 75, 255, 30);
textField.font = [UIFont fontWithName:@"ArialMT" size:20];
textField.placeholder = @"Preset Name";
textField.textAlignment = UITextAlignmentCenter;
textField.keyboardAppearance = UIKeyboardAppearanceAlert;
[textField becomeFirstResponder];
[alert addSubview:textField];
【问题讨论】:
-
你说的是土豆。我说番茄。所以你说你想使用 UITextView。但是您的代码表明您使用的是文本字段。
标签: ios objective-c uialertview