这是 AlertTableView 中的代码:
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex{
NSInteger index = 12345;
NSLog(@"AlertTableView: selecting row at index %d", index);
[self.caller didSelectRowAtIndex:index withContext:self.context];
}
在 self.caller 中:
- (void)didSelectRowAtIndex:(NSInteger)row withContext:(id)context {
NSLog(@"Selected row at index %d with context %@", index, context);
}
控制台输出:
2009-05-07 15:51:30.619 Whiteboard[15165:20b] AlertTableView: selecting row at index 12345
2009-05-07 15:51:30.620 Whiteboard[15165:20b] Selected row at index -1758050543 with context <Picker: 0x587c20>