Cocoa touch 确定UIPickerWheel是否正在滚动

Cocoa touch 确定UIPickerWheel是否正在滚动,cocoa-touch,ios,uikit,uipickerview,Cocoa Touch,Ios,Uikit,Uipickerview,嘿,有没有办法确定UIPickerView当前正在滚动,我真的需要我的应用程序的功能,这非常重要。谢谢 有一个UIPickerViewDelegate方法,基本上每次滚动选择器时都会触发该方法 - (NSString *)pickerView:(UIPickerView *)pickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component 为选择器设置委托,实现此方法并查看发生了什么 [编辑]好的,现在我知道你需要什

嘿,有没有办法确定UIPickerView当前正在滚动,我真的需要我的应用程序的功能,这非常重要。谢谢

有一个UIPickerViewDelegate方法,基本上每次滚动选择器时都会触发该方法

- (NSString *)pickerView:(UIPickerView *)pickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component
为选择器设置委托,实现此方法并查看发生了什么

[编辑]好的,现在我知道你需要什么了。 实现一个计时器,用于检查选择器的状态

checkTimer = [NSTimer scheduledTimerWithTimeInterval:0.01 target:self selector:@selector(checkPicker) userInfo:nil repeats:YES];
在上面的委托方法中,存储上次移动选择器的时间

lastPickerDate = [[NSDate date] retain];
在checkPicker方法中,检查上次移动经过的时间

NSTimeInterval timeSinceMove = -[lastPickerDate timeIntervalSinceNow];

如果timeSinceMove大于某个期望值,即0.5秒,请将布尔选择器移动设置为false。否则将其设置为真。这不是检查移动的最精确方法,但我认为它应该可以完成这项工作…

有一个UIPickerViewDeleteGate方法,基本上每次滚动选择器时都会触发该方法

- (NSString *)pickerView:(UIPickerView *)pickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component
为选择器设置委托,实现此方法并查看发生了什么

[编辑]好的,现在我知道你需要什么了。 实现一个计时器,用于检查选择器的状态

checkTimer = [NSTimer scheduledTimerWithTimeInterval:0.01 target:self selector:@selector(checkPicker) userInfo:nil repeats:YES];
在上面的委托方法中,存储上次移动选择器的时间

lastPickerDate = [[NSDate date] retain];
在checkPicker方法中,检查上次移动经过的时间

NSTimeInterval timeSinceMove = -[lastPickerDate timeIntervalSinceNow];

如果timeSinceMove大于某个期望值,即0.5秒,请将布尔选择器移动设置为false。否则将其设置为真。这不是检查移动的最精确方法,但我认为它应该可以完成这项工作…

有一个技巧可以检测到这一点,但没有委托方法/属性来检测它是否在滚动

  • 把一项财产当作是廉价品
  • func-pickerView(\pickerView:UIPickerView,titleForRow行:Int,forComponent-component:Int)->String?
    或等效方法中,将IsCrolling设置为true
  • func-pickerView(pickerView:UIPickerView,didSelectRow-row-Int,incomonent-component-Int)中将isScrolling设置为false

  • 有一个技巧可以检测到这一点,但是没有委托方法/属性来检测它是否在滚动

  • 把一项财产当作是廉价品
  • func-pickerView(\pickerView:UIPickerView,titleForRow行:Int,forComponent-component:Int)->String?
    或等效方法中,将IsCrolling设置为true
  • func-pickerView(pickerView:UIPickerView,didSelectRow-row-Int,incomonent-component-Int)中将isScrolling设置为false

  • 我已经实现了,但它不符合我的目的。我需要像true false这样的值,它告诉我pickerView滚动。我已经实现了,但它不符合我的目的。我需要像真假值这样的东西,它告诉我是pickerView滚动。