How can I pass the textview value to the alertController textFields block?
I have the textview component call "myTextView"
@property (weak, nonatomic) IBOutlet UITextView *myTextView
I set the alertcontroller below:
myAlertController = [UIAlertController alertControllerWithTitle:@"title" message:@"pass the value in alertcontroller" preferredStyle: UIAlertControllerStyleAlert];
myAlertControllerOKAction = [UIAlertAction actionWithTitle:@"sure" style:UIAlertActionStyleDefault
handler:nil];
[myAlertController addTextFieldWithConfigurationHandler:^(UITextField *textField) {
textField.keyboardType = UIKeyboardTypeDefault;
textField.text = [self.myTextView.text stringByTrimmingCharactersInSet:[NSCharacterSet newlineCharacterSet]];
}];
[myAlertController addAction: myAlertControllerOKAction];
But I set the myTextView.text in the myAlertController block,
textField.text = [self.myTextView.text stringByTrimmingCharactersInSet:[NSCharacterSet newlineCharacterSet]];
}];
It will show
Capturing 'self' strongly in this block is likely to lead to a retain cycle
How can I get the textview value in the alert controller block for textfield use?