首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >UIAlertView + UITextView

UIAlertView + UITextView
EN

Stack Overflow用户
提问于 2015-05-07 17:15:59
回答 1查看 1.6K关注 0票数 1

我在找人帮忙。我需要知道如何在UIAlertView上实现多行文本输入。我不想使用UITextField,它有单行输入。

在UIAlertViews被否决之前,我常常这样做:

代码语言:javascript
复制
    -(IBAction)addComment:(id)sender
{
    //multiline comments
    UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"Export"
                                                        message:@"Save this report to the feed with a comment?"
                                                       delegate:self
                                              cancelButtonTitle:@"No"
                                              otherButtonTitles:@"Yes", nil];

    alertView.alertViewStyle = UIAlertViewStylePlainTextInput;
    UITextView *textView = [UITextView new];
    [alertView setValue: textView forKey:@"accessoryView"];
    alertView.tag = 3;
    [alertView show];
}

- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
{
    //Check for confirmation on exporting.
    if (alertView.tag == 3) {
        UITextView *textView = [UITextView new];
        [alertView setValue: textView forKey:@"accessoryView"];
        if (buttonIndex == 1)[self writeData:textView.text];
    }
}

iOS8+ --这似乎不适用于我,来自textView的数据始终是空的。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2015-05-07 17:41:54

我需要知道如何在UIAlertView上实现多行文本输入。

您不需要。如果您需要的不仅仅是内置UIAlertView提供的内容,那么就制作您自己的视图控制器,它看起来和行为都像UIAlertView,但是视图是您的视图,您可以任意定制它。

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/30107718

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档