I'm tying to call didDismissWithButtonIndex
on UITextView
Class ,but it not called.
I also implement UIAlertViewDelegate
on MyViewcontroller.h
file and [alert setDelegate:self]
to method.
So is that possible to call UIAlertView
Delegate method in UITextView
Class ??
+ (void)deleteTextr:(UITapGestureRecognizer *)gestureRecognizer
{
if (gestureRecognizer.state == UIGestureRecognizerStateBegan)
{
UIAlertView *alert = [[UIAlertView alloc]initWithTitle:@"" message:@"Delete Text !!!!" delegate:self cancelButtonTitle:@"Delete" otherButtonTitles:@"No", nil];
[alert setDelegate:self];
[alert show];
}
}
- (void)alertView:(UIAlertView *)alertView didDismissWithButtonIndex:(NSInteger)buttonIndex
{
if(buttonIndex == 1)
{
[self removeFromSuperview];
}
}
just change delegate method to class method. like this:
- (void)alertView:(UIAlertView *)alertView didDismissWithButtonIndex:(NSInteger)buttonIndex;
// - change to +
+ (void)alertView:(UIAlertView *)alertView didDismissWithButtonIndex:(NSInteger)buttonIndex;