2

这是 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>
4

1 回答 1

4

看起来您的方法范围内没有“索引”,请尝试以下操作:

- (void)didSelectRowAtIndex:(NSInteger)row withContext:(id)context {
  NSLog(@"Selected row at index %d with context %@", row, context);
}

只是看起来像一个错字:)

于 2009-05-07T23:13:07.950 回答