0
我想要一个用户旋转一个选择器,当特定的行出现时,它应该加载一个合适的数组并将其显示在UITableView中。如果用户确实需要而不是必须旋转选取器,然后按下单独的“选择”按钮。UITableView不更新为拾取器转向
我有通常的选择器和表格方法,但表格不会随着选取器旋转而更新。该表不会在最初的NIB负载上进行更新,但此后没有任何更新。
这是选取方法。数组被加载并且reloadData被调用,但是然后什么都没有......?
帮助赞赏。
(void)pickerView:(UIPickerView *)thePickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component {
NSLog(@"Selected: %@. Index: %i", [pickerSelections objectAtIndex:row], row);
pickerChoice = [pickerSelections objectAtIndex:row];
if ([email protected]"String1"){
NSLog(@"load Array1");
Names1 = [[NSArray alloc]initWithObjects:@"Bob Jones",@"Joe Brown",@"Nigel Smith",nil];
[contactTable reloadData];
}else if ([email protected]"String2"){
NSLog(@"load Array2");
Names2 = [[NSArray alloc]initWithObjects:@"Bob Jennings",@"Joe Brown",@"Nigel Smith",nil];
[contactTable reloadData];
}
}
您确定contactTable的IBOutlet在IB中连接正确吗?另外,您应该使用isEqualToString:而不是==。 – Anna 2011-04-28 03:05:11
您可以发布表视图数据源的cellforrowatindexpath代码吗? – drewag 2011-04-28 03:46:49