我在找人帮忙。我需要知道如何在UIAlertView上实现多行文本输入。我不想使用UITextField,它有单行输入。
在UIAlertViews被否决之前,我常常这样做:
-(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的数据始终是空的。
发布于 2015-05-07 17:41:54
我需要知道如何在UIAlertView上实现多行文本输入。
您不需要。如果您需要的不仅仅是内置UIAlertView提供的内容,那么就制作您自己的视图控制器,它看起来和行为都像UIAlertView,但是视图是您的视图,您可以任意定制它。
https://stackoverflow.com/questions/30107718
复制相似问题