【问题标题】:Text input popup box文本输入弹出框
【发布时间】: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


【解决方案1】:

您是否正在研究类似CODialog 的内容。我不确定它是否对您的确切情况有所帮助,Apple 不赞成破解 UIAlertView 的详细信息,因此不会有面向未来的代码。

UIAlertView

UIAlertView 类旨在按原样使用,不支持子类化。 此类的视图层次结构是私有的,不得修改。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-07-13
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多