I am having a view which contains a pickerView and a TextView.
The scrolling is getting stuck more and more when i present my view.
After coming 4-5 times to the view, it stuck more and more and finally UI get completely freeze while scrolling the UIPickerView. The PickerView is haveing 4 components out of which 3 has around 50 value.
Please check my PickerView code below:
- (NSInteger)numberOfComponentsInPickerView:(UIPickerView *)pickerView
{
return 4;
}
// The number of rows of data
- (NSInteger)pickerView:(UIPickerView *)pickerView numberOfRowsInComponent: (NSInteger)component
{
return [[_pickerData objectAtIndex:component] count];
}
- (CGFloat)pickerView:(UIPickerView *)pickerView widthForComponent: (NSInteger)component
{
switch (component){
case 0:
return 150.0;
case 1:
return 50.0f;
case 2:
return 20.0f;
case 3:
return 50.0f;
}
return 0;
}
- (UIView *)pickerView:(UIPickerView *)pickerView viewForRow:(NSInteger)row forComponent:(NSInteger)component reusingView:(UIView *)view{
UILabel* tView = (UILabel*)view;
if (!tView){
tView = [[UILabel alloc] init];
tView.font=[UIFont fontWithName:@"ArialNarrow" size:22];
tView.textAlignment=NSTextAlignmentCenter;
tView.text=_pickerData[component][row];
// Setup label properties - frame, font, colors etc
}
return tView;
}
Please help me.
Thanks for the help Garry.
I have solved the issue. The issue was with the thread. I found the issue by pausing the app whenever the app freezes. On the left side, we can see the running thread. From there I caught the thread called. It was disturbing the main thread and that is why app was getting freeze.