2015-01-08 2 views
1

정말 이상합니다. 나는 이런 것을 본적이 없다. 나는 UIViewController 분류 방법에 경고보기를 보여주는 해요 :alertView : clickedButtonAtIndex : 호출되지 않았습니다. 다른 대리자 메서드가 호출됩니다.

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]; 

-(void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex가 호출되지 않습니다!

그러나 다른 대리자 메서드, - (void)alertView:(UIAlertView *)alertView didDismissWithButtonIndex:(NSInteger)buttonIndex

- (void)alertView:(UIAlertView *)alertView willDismissWithButtonIndex:(NSInteger)buttonIndex이 성공적이라고합니다! 이런 젠장? 이런 건 본 적이 있니?

답변

0

원인은 내가 이미 -(void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex 내보기 컨트롤러 클래스에서 정의 된 있지만 화재 범주에서 동일한 메서드를 기대했다. 따라서 생각한 결론은 범주에서 대리자 메서드를 제공하지 않는 것입니다. 위험 할 수 있습니다.

관련 문제