RxDataSources icon indicating copy to clipboard operation
RxDataSources copied to clipboard

How to set rowHeightForComponent for a UIPickerView

Open dvera128 opened this issue 6 years ago • 0 comments

Hi, I'm using RxPickerViewAttributedStringAdapter to set up a UIPickerView:

let adapter = RxPickerViewAttributedStringAdapter<[String]>(
      components: [],
      numberOfComponents: { _,_,_ in 1 },
      numberOfRowsInComponent: { (_,_, items,_) -> Int in return items.count },
      attributedTitleForRow: { (_,_, items, row,_) -> NSAttributedString? in
        return NSAttributedString(string: "\(items[row].firstUppercased)",
          attributes: [NSAttributedString.Key.foregroundColor: UIColor.black])
    })

Observable.of(["apple", "lemon"]).bind(to: picker.rx.items(adapter: adapter)).disposed(by: disposeBag)

But when I use picker.rx.setDelegate(self).disposed(by: disposeBag) attributedTitleForRow is ignored

How can I solve this???

Thanks!

dvera128 avatar Mar 13 '19 16:03 dvera128