UIAlertController for UITextView


I ran into a problem for not being able replace the UITextField for a UITextView.
What I need is about 4 lines for my text.

Any help would be deeply appreciated

Hi Robert - what’s it doing that it should not be doing? Are you able to get the control changed in storyboard, where are things going wrong?

I attached the program working for text field
Sadly I am totally lost in to making it work for text view
All the files that I have found googling were for text fields
That is where I am stuck

OK I have it. You need to take a reference to the textField or else it does not exist when you are trying to read from it.

Add a UITextField reference, like:

@interface ViewController ()<UITextFieldDelegate>
    NSString *arr;
    UITextField *myTextField;

In addTextFieldWithConfigurationHandler, take a reference to the textField, like:

[alertController addTextFieldWithConfigurationHandler:^(UITextField *textField) {
    textField.delegate = self;
    textField.text = @"";
    self->myTextField = textField;
    NSLog(@"The textField text is - %@",textField.text);

Then you can get a value from that textField using your reference:

UIAlertAction *actionAlert = [UIAlertAction actionWithTitle:@"Save"
                                                    handler:^(UIAlertAction * action) {
                                                        NSString *text = ((UITextField *)[alertController.textFields objectAtIndex:0]).text;
                                                        NSLog(@"Display Text: %@", myTextField.text);

The item that I want to replace is the text field. For I need a Text View
I have been searching endlessly to try to grasp the Text View for UI Alert.

Thank you for your patience in helping me.

Thank you

I understand now - sorry but I believe the answer is simply “that’s not possible with UIAlertView”.

I think what you should do is define a view that you can present modally, with all the controls and fields that you require. UIAlertView just doesn’t support this.

I started to believe that was the problem. I changed my plan and went with a View instead with a Container View to control the TextView. And that is working.
Thank you very much for taking the time to give me some clear direction.

I am in the process of taking my time and converting the program for Swift 3 with Core Data.

Thank you also to the others for trying to helping me.