Reputation: 1261
i wanna to hide selection lines in picker view i tried this in
datePicker.subviews[0].subviews[1].hidden = true
datePicker.subviews[0].subviews[2].hidden = true
in this method
func pickerView(pickerView: UIPickerView, titleForRow row: Int, forComponent component: Int) -> String! {
weightPicker.subviews[0].subviews[1].hidden = true
weightPicker.subviews[0].subviews[2].hidden = true
return weightNumber[row] as! String
}
but it has no effect. And if i put this in view did load app will crash
Upvotes: 1
Views: 2472
Reputation: 3802
Write below code in viewDidLayoutSubviews() method.
Objective-C
pickerView.subview[1].backgroundColor = UIColor.whiteColor()
pickerView.subview[2].backgroundColor = UIColor.whiteColor()
Swift 3.0
pickerView.subviews[1].isHidden = true
pickerView.subviews[2].isHidden = true
Upvotes: 0