Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/108.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/objective-c/24.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios alertView:ClickedButtonIndex:未调用。调用其他委托方法_Ios_Objective C_Cocoa Touch_Uikit_Uialertview - Fatal编程技术网

Ios alertView:ClickedButtonIndex:未调用。调用其他委托方法

Ios alertView:ClickedButtonIndex:未调用。调用其他委托方法,ios,objective-c,cocoa-touch,uikit,uialertview,Ios,Objective C,Cocoa Touch,Uikit,Uialertview,真奇怪。我从没见过这样的事。我正在UIViewController类别方法中显示警报视图: UIAlertView *alertView = [[UIAlertView alloc]initWithTitle:title message:message delegate:self cancelButtonTitle:cancelButtonTitle otherButtonTitles:nil]; for(NSString *buttonTitle in otherButtonTitles

真奇怪。我从没见过这样的事。我正在UIViewController类别方法中显示警报视图:

  UIAlertView *alertView = [[UIAlertView alloc]initWithTitle:title message:message delegate:self cancelButtonTitle:cancelButtonTitle otherButtonTitles:nil];

for(NSString *buttonTitle in otherButtonTitles){
    [alertView addButtonWithTitle:buttonTitle];
}
objc_setAssociatedObject(self, &kVCActionHandleAlertCancelBlockKey, cancelBlock, OBJC_ASSOCIATION_COPY_NONATOMIC);
objc_setAssociatedObject(self, &kVCActionHandleAlertOtherBlockKey, otherBlock, OBJC_ASSOCIATION_COPY_NONATOMIC);
[alertView show];
和-voidalertView:UIAlertView*alertView ClickedButtonIndex:NSIntegerbuttonIndex永远不会调用

但是其他委托方法,-voidalertView:UIAlertView*alertView使用ButtonIndex:NSIntegerbuttonIndex进行了dismiss


和-voidalertView:UIAlertView*成功调用alertView willDismissWithButtonIndex:NSIntegerbuttonIndex!搞什么鬼?您见过类似的情况吗?

原因是我已经-voidalertView:UIAlertView*alertView单击了视图控制器类中定义的按钮索引:NSIntegerbuttonIndex,但希望触发类别中相同的方法。因此,我认为结论是永远不要在类别中提供委托方法。这可能很危险