小编Kyl*_*isi的帖子

UIPickerView直到滚动才重新加载

使用段控件我正在尝试使用新的数据数组重新加载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连接到文件的所有者,用于委托和数据源.

xcode objective-c uisegmentedcontrol uipickerview

2
推荐指数
1
解决办法
717
查看次数

PHP变量问题

这有效:

$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)

为什么?我想我不明白变量是如何工作的.

php variables

0
推荐指数
1
解决办法
61
查看次数