【发布时间】:2012-02-10 13:38:57
【问题描述】:
请查看我用来在表格视图中添加动态单元格添加运行时间的代码。在选择我的表格视图时,我调用了这个方法。
- (void) allServersFound
{
// called from delegate when bonjourservices has listings of machines:
NSArray *newPosts = [[NSArray alloc]initWithObjects:@"A", nil]; // NSArray of machine names;
NSMutableArray *tempArray = [[NSMutableArray alloc] initWithObjects: @"A",@"B",@"C",@"D", nil];
int i = 0;
for (NSArray *count in newPosts)
{
[tempArray addObject:[NSIndexPath indexPathForRow:i++ inSection:0]];
}
[[self tblHome] beginUpdates];
[[self tblHome] insertRowsAtIndexPaths:tempArray withRowAnimation:UITableViewRowAnimationNone];
[[self tblHome] endUpdates];
[tempArray release];
}
但这在运行时给了我以下异常: * 由于未捕获的异常“NSInvalidArgumentException”而终止应用程序,原因:'-[NSIndexPath _fastCStringContents:]:无法识别的选择器发送到实例 0x4e0e130
【问题讨论】:
标签: iphone objective-c ios ipad