MyAlertView (subclass of UIAlertView) has this method:
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex {
if (self.clickedButtonAtIndexBlock != NULL)
self.clickedButtonAtIndexBlock(buttonIndex);
}
My question is how do I define the callback when I create the alert view? Obviously this is wrong:
alert.clickedButtonAtIndexBlock = ^{
NSLog(@"clicked: %d", buttonIndex);
}
Try doing something like this (I haven’t tested it):