这是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>
答案 0 :(得分:4)
看起来你的方法在范围上看起来不像“索引”,试试这个:
- (void)didSelectRowAtIndex:(NSInteger)row withContext:(id)context {
NSLog(@"Selected row at index %d with context %@", row, context);
}
看起来像是一个错字:)