使用段控件我正在尝试使用新的数据数组重新加载2个UIPickerViews.
我的问题是,直到我在选择器上向上或向下滚动时,新数组才会显示(旧数据一旦离开视图就会消失).我试过使用reloadAllComponents方法没有运气.这是代码的样子:
//Segment Control
-(IBAction)unitType:(id)sender {
if([sender selectedSegmentIndex]==0){
NSLog(@"unitType change 1");
NSLog(@"before values = %@",units);
[units removeAllObjects];
[units addObject:@"in"];
//etc.
[self.inputUnits reloadAllComponents];
NSLog(@"current values = %@",units);
}else {
NSLog(@"unitType change 2");
NSLog(@"before values = %@",units);
[units removeAllObjects];
[units addObject:@"in^3"];
//etc.
[self.inputUnits reloadAllComponents];
NSLog(@"current values = %@",units);
}
}
Run Code Online (Sandbox Code Playgroud)
IB有2个UIPickerViews连接到文件的所有者,用于委托和数据源.
这有效:
$customerBox = mysql_query("MY SQL STATEMENT HERE");
$boxRow = mysql_fetch_array($customerBox);
$customerBox = mysql_query("MY SQL STATEMENT AGAIN");
while($item = mysql_fetch_assoc($customerBox)) {
foreach ($item as $columnName => $value) {
if (empty($value)) {
print $columnName;
}
}
}
Run Code Online (Sandbox Code Playgroud)
这不是:
$customerBox = mysql_query("MY SQL STATEMENT HERE");
$boxRow = mysql_fetch_array($customerBox);
while($item = mysql_fetch_assoc($customerBox)) {
foreach ($item as $columnName => $value) {
if (empty($value)) {
print $columnName;
}
}
}
Run Code Online (Sandbox Code Playgroud)
为什么?我想我不明白变量是如何工作的.