简体   繁体   中英

iOS 14 UIPickerView color of the selected row

在此处输入图像描述

in iOS 14 the UIPickerView has default a grey background on the selected Row,

I can't find a way to change it

Just to clarify, the code:

if #available(iOS 14.0, *) { pickerView.subviews[1].backgroundColor = .clear }

needs to go in the following protocol method:

func pickerView(_ pickerView: UIPickerView, viewForRow row: Int, forComponent component: Int, reusing view: UIView?) -> UIView {

}

在此处输入图片说明 I solved my problem like this

if #available(iOS 14.0, *) { pickerView.subviews[1].backgroundColor = .clear }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM