我想打电话didDismissWithButtonIndex
给UITextView
Class ,但没有打电话。我还实现UIAlertViewDelegate
了MyViewcontroller.h
文件和[alert setDelegate:self]
方法。
那么可以在Class中调用UIAlertView
Delegate 方法吗?UITextView
+ (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];
}
}