iphone uipickerview : image and text

ⅰ亾dé卋堺 提交于 2019-12-06 08:11:25

问题


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:


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



来源:https://stackoverflow.com/questions/10706459/iphone-uipickerview-image-and-text

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!