我在设备上面临这个问题,即分配选择器的选定行值需要太多时间才能显示在标签上,而在模拟器上它工作正常。
下面是代码:
-(void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row
inComponent:(NSInteger)component
{
if (pickerView == rewardsName) {
NSString *selectedReward = [self.rewards objectAtIndex:row];
if ([reward1.text length]==0){
//set label 1
reward1.text = selectedReward;
}
if ([reward2.text length]==0){
//set label 2
reward2.text = selectedReward;
}
if([reward3.text length]==0){
//set label 3.
reward3.text = selectedReward;
}
}
else if(pickerView == selectNamazPicker){
aNumberString = [self.namazArray objectAtIndex:row];
NSLog(@"aNumberString:: %@", aNumberString);
}
}
谁能告诉我可能是什么问题...我找不到...
**
EDITED:
ISSUE RESOLVED:
**
For others who would face this issue.
I don't know whether it was creating the problem or not. But I did make these changes to my code.
In my .h file, previously I was just defining properties of UILabels (reward1, reward2 etc) with IBOutlet and not ivars. But then I defined ivars as IBOutlet UILabel reward1; etc and eliminated IBOutlet from properties then it started working fine.
Now the problem has resolved.