我有這個小問題,我找不到Google: UITableView
工作正常,直到我開始滾動。- [NSCFString objectAtIndex:]:無法識別的選擇器
Error Message: `-[NSCFString objectAtIndex:]: unrecognized selector sent to instance 0x5f24870 `
方法:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *MyIdentifier = @"MyIdentifier";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:MyIdentifier];
if (cell == nil)
{
cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:MyIdentifier] autorelease];
}
// Set up the cell
int storyIndex = [indexPath indexAtPosition: [indexPath length]-1];
//populate cell
cell.textLabel.text = [[myArray objectAtIndex: storyIndex] objectForKey: @"subject"];
return cell;
}
就猜到這是「問題」 - 方法......如果你需要更多的相關信息:請告訴我:) 感謝您的幫助!
編輯: myArray的僅僅是正常NSArray *myArray
這是一個排序的數組 - >
NSSortDescriptor *sortDescriptor = [[NSSortDescriptor alloc] initWithKey:@"lesson" ascending:YES];
NSArray *sortDescriptors = [[NSArray alloc] initWithObjects:sortDescriptor, nil];
myArray = [resultArray sortedArrayUsingDescriptors:sortDescriptors];
resultArray(NSMutableArray的)是一個XML解析器的結果..希望你能看到我的問題..
如何創建myArray的對象? – Vladimir 2010-10-18 14:56:38
感謝您的意見..見編輯.. – dav3 2010-10-18 15:08:51