我想建立一个弹出式警报视图,允许用户输入文本输入。我试过下面的代码。
它可以工作,除非我需要一个更大的文本区,比如- UITextView。然而,当我使用具有更大帧面积的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];发布于 2013-06-23 02:35:26
你有没有调查过像CODialog这样的东西。我不确定它是否能在你的实际情况下有所帮助,黑客攻击UIAlertView的细节是苹果不赞成的,所以不会有面向未来的代码。
UIAlertView
UIAlertView类旨在按原样使用,不支持子类化。此类的视图层次结构是私有的,不能修改。
https://stackoverflow.com/questions/17253835
复制相似问题