UIPickerView selection indicator not visible in iOS10

前端 未结 7 2053
刺人心
刺人心 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:48

    Solved this problem using subclass of UIPickerView:

    import UIKit
    
        class FixedPickerView: UIPickerView, UIPickerViewDelegate {
    
            override func willMove(toSuperview newSuperview: UIView?) {
                self.delegate = self
                self.selectRow(0, inComponent: 0, animated: true)
                self.delegate = nil
                super.willMove(toSuperview: newSuperview)
            }
        }
    

提交回复
热议问题