iphone uipickerview : image and text

2019-04-12 10:01发布

is it possible to have an image (like an icon) next to a text in UIPickerView ?

I saw examples of UIPickerViews with two Columns :one that has an image and another one with the text . this is not what I need , I need to have a single column with text and Images

Thanks.

1条回答
可以哭但决不认输i
2楼-- · 2019-04-12 11:04

You will need to create your own view for each row of the picker. This is easy enough if it's just a UIImageView and a UILabel. You can then pass the view to your picker using this UIPickerViewDelegate method.

- (UIView *)pickerView:(UIPickerView *)pickerView viewForRow:(NSInteger)row forComponent:(NSInteger)component reusingView:(UIView *)view

查看更多
登录 后发表回答