UIPickerView selection indicator not visible in iOS10

前端 未结 7 2040
刺人心
刺人心 2021-02-04 06:01

I build my project in Xcode 8. UIPickerView separator lines are not visible in iOS 10 simulator and the devices, but works fine on iOS 9.3 devices and simulator. I tried to adju

相关标签:
7条回答
  • 2021-02-04 06:55

    I have faced the same issue in iOS10, too. Here is my problem:

    And I solved this problem by:

     self.pickerView.backgroundColor = COLOR_DEDEDE;
     self.pickerView.showsSelectionIndicator = YES;
        for (UIView *view in self.pickerView.subviews) {
            if (view.bounds.size.height < 2.0f && view.backgroundColor == nil) {
                view.backgroundColor = PICK_Line_COLOR; // line color
            }
        }
    

    Note:

    this code mush be called after method:[self.view addSubview:pickeView];

    The final result:

    it works in my project. Hope it helps to you.

    0 讨论(0)
提交回复
热议问题