Fixed labels in the selection bar of a UIPickerView

前端 未结 12 1239
一生所求
一生所求 2020-11-27 12:17

In the clocks application, the timer screen shows a picker (probably a UIPicker in UIDatePickerModeCountDownTimer mode) with some text in the selec

12条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-11-27 12:55

    I received an answer that works well in iOS 7 to my question, which is a pretty cool trick.

    The idea is to create multiple components, and for those label components, specify that it's a single row. For the embossed look that some people have, you can return NSAttributedStrings with the delegate method:

    - (NSAttributedString *)pickerView:(UIPickerView *)pickerView attributedTitleForRow:(NSInteger)row forComponent:(NSInteger)component

提交回复
热议问题