I have a UIAlertView with a UITextField. I have connected a UIAlertView delegate, and I believe YES or NO in alertViewShouldEnableFirstOtherButton: depending on the text in the UITextField.
I need to change the text of the text field programmatically. This works as expected.
Unfortunately, I donβt know how to make UIAlertView call the delegate method alertViewShouldEnableFirstOtherButton: to enable or disable another button after I changed the text of the text box.
I thought that the UIAlertView was registered as a UITextField object, so I tried sending UIControlEventValueChanged from textField. Does not work.
From the stack trace, it turned out that the delegate method was called from the private UIAlertView _alertSheetTextFieldDidChange: method.
So, if I do [self.currentAlert performSelector:@selector(_alertSheetTextFieldDidChange:) withObject:textField]; after changing the text, the delegate method is called and the state for turning on the button changes. But, since this is a private method, the application is likely to be rejected. I do not want to risk it.
Is there a clean way to make an alertViewShouldEnableFirstOtherButton: view alert alertViewShouldEnableFirstOtherButton: ?
Matthias bauch
source share