在下面的代码中,我试图将用户选择的名称添加到arrayDoctors
,比如说A,B
,然后我将它添加到selectedDoctors
数组中。但是第二次我选择医生C,D
并将其添加到selectedDoctors
数组中,它将先前的对象替换A,B
为C
and D
。
- (void)doneDoctorSelection:(id)sender
{
[pop3 dismissPopoverAnimated:YES];
NSString *str = [arrayDoctors objectAtIndex:0];
NSString *str1 = [str stringByAppendingString:[NSString stringWithFormat:@" + %d",arrayDoctors.count-1]];
if([arrayDoctors count] == 1)
lblDoctor.text = str;
else
lblDoctor.text = str1;
[selectedDoctors addObject:arrayDoctors];
[selectedDoctorIdList addObject:arrayDoctorsId];
NSLog(@"selectedDoneDoctors %@ ",selectedDoctors);
}
我究竟做错了什么?