didSelectRow
에 행 번호를 저장하고 selectedRowInComponent
의 행과 비교하여 해결했습니다.
-(BOOL) isCardPickerSpinning{
return (lastCardPickerRow != [cardPicker selectedRowInComponent:0]);}
나는 또한 스피너가 움직일 때 메서드를 호출하는 데 사용될 부울을 만들었습니다.
-(void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row
inComponent:(NSInteger)component
{
lastCardPickerRow = row;
pickerInMotion = NO;
//update UI code goes here
eventSwitch.enabled = YES;
}
-(void)pickerViewMotionStart
{
//disable my UI
eventSwitch.enabled = NO;
}
- (UIView *)pickerView:(UIPickerView *)pickerView
viewForRow:(NSInteger)row
forComponent:(NSInteger)component
reusingView:(UIView *)view {
UILabel *pickerLabel = (UILabel *)view;
if (pickerLabel == nil) {
CGRect frame = CGRectMake(0.0, 0.0, 200, 32);
pickerLabel = [[UILabel alloc] initWithFrame:frame];
pickerLabel.textAlignment=NSTextAlignmentLeft;
}
if (!pickerInMotion)
{
pickerInMotion = YES;
[self pickerViewMotionStart];
}
pickerLabel.text = @"SomeString";
return pickerLabel;
}
출처
2014-09-27 05:22:01
JVC
는 http://stackoverflow.com/questions/5304839/determining-if-uipickerwheel-is-scrolling – rmaddy