我在段控件中有两个数组和三个按钮
-(void)viewDidLoad{
if(!resultArray){
resultArray =[[NSMutableArray alloc] init];
}
[self setUpData];
if(!nextArray){
nextArray =[[NSMutableArray alloc] init];
}
[self nextData];
appointmentsOfDay = [[NSMutableArray alloc] arrayWithArray:resultArray copyItems:YES];
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return [appointmentsOfDay count];
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
UILabel * dobLabel = nil;
static NSString * Identifier = @"Identifier";
UITableViewCell * cell = [table dequeueReusableCellWithIdentifier:Identifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:Identifier] autorelease];
dobLabel = [[UILabel alloc] initWithFrame:CGRectMake(200, 6, 100, 32)];
dobLabel.font = [UIFont systemFontOfSize:15];
dobLabel.tag = 999;
[cell addSubview:dobLabel];
[dobLabel release];
}
else {
dobLabel = (UILabel *)[cell viewWithTag:999];
}
appDelegate = (EMRAppDelegate *)[[UIApplication sharedApplication] delegate];
ObjectData *theCellData = [appointmentOfDay objectAtIndex:indexPath.row];
cell.textLabel.font = [UIFont systemFontOfSize:15];
cell.textLabel.textAlignment = UITextAlignmentLeft;
cell.textLabel.text=[NSString stringWithFormat:@"%@ %@",theCellData.firstName,theCellData.lasttName];
dobLabel.text = theCellData.appointmentTime;
return cell;
}
- (void)onDayButtonClick:(id)sender
{
UISegmentedControl * segmentedControl = (UISegmentedControl *)sender;
[appointmentsOfDay removeAllObjects];
if (segmentedControl.selectedSegmentIndex == 0) {
[appointmentsOfDay removeAllObjects];
appointmentsOfDay = [[NSMutableArray alloc] arrayWithArray:resultArray copyItems:YES];
}
else if (segmentedControl.selectedSegmentIndex == 1) {
[appointmentsOfDay addObject:nextArray];
}
else if (segmentedControl.selectedSegmentIndex == 2) {
}
[table reloadData];
}
崩溃报告
EMR[1161:10703] -[__NSPlaceholderArray arrayWithArray:copyItems:]: unrecognized selector sent to instance 0x7320120
2012-04-09 14:13:35.021 EMR[1161:10703] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSPlaceholderArray arrayWithArray:copyItems:]: unrecognized selector sent to instance 0x7320120'
*** First throw call stack:
(0x201d052 0x2d01d0a 0x201eced 0x1f83f00 0x1f83ce2 0xc7a7 0x6bc64e 0x6bc941 0x6ce47d 0x6ce66f 0x6ce93b 0x6cf3df 0x6cf986 0x6cf5a4 0x9660 0x201eec9 0x5f95c2 0x5f955a 0x69eb76 0x69f03f 0x69e2fe 0x61ea30 0x61ec56 0x605384 0x5f8aa9 0x2f72fa9 0x1ff11c5 0x1f56022 0x1f5490a 0x1f53db4 0x1f53ccb 0x2f71879 0x2f7193e 0x5f6a9b 0x25bd 0x2535)
terminate called throwing an exception(lldb)