开发者

How can i customize UIDatePicker for Hijri

开发者 https://www.devze.com 2023-01-27 10:00 出处:网络
How can i customize U开发者_如何学CIDatePicker for Hijri? Like this In your ViewController, adopt the UIPickerViewDelegate protocol, and add a UIPickerView to the view, setting its delegate and dataso

How can i customize U开发者_如何学CIDatePicker for Hijri? Like this

How can i customize UIDatePicker for Hijri


In your ViewController, adopt the UIPickerViewDelegate protocol, and add a UIPickerView to the view, setting its delegate and datasource to self.

Override the pickerView:widthForComponent: method from UIPickerViewDelegate to have a custom width for each component (a component is a "column", so here you have three)

Override the numberOfComponentsInPickerView: from the UIPickerViewDataSource protocol an return 3

To populate your picker, use pickerView:titleForRow:forComponent: from UIPickerViewDelegate and numberOfComponentsInPickerView: from UIPickerViewDataSource

For a cleaner and more reusable code, I'll just subclass UIPickerView

0

精彩评论

暂无评论...
验证码 换一张
取 消