iphone uipickerview:图像和文本 [英] iphone uipickerview : image and text

查看:53
本文介绍了iphone uipickerview:图像和文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以在 UIPickerView 中的文本旁边放置图像(如图标)?

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

我看到了 UIPickerViews 的示例,该示例有两列:一个包含图像,另一个包含文本.这不是我所需要的,我需要将一列包含文本和图像

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

谢谢.

推荐答案

您将需要为选择器的每一行创建自己的视图.如果只是一个UIImageView和一个UILabel,这很容易.然后,您可以使用此UIPickerViewDelegate方法将视图传递给选择器.

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)组件reusingView:(UIView *)view

这篇关于iphone uipickerview:图像和文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆