从 UIPickerView 获取带有图像的 UIView
我有一个 UIPicker 视图,包含 4 列,每列中有 6 个图像的相同数组(颜色)。我有一个按钮,按下该按钮后,将在 UIPickerView 上以单独的视图显示 4 个图像。问题是,我似乎找不到从 UIPickerView 获取 UIView 的方法。
这是完成的应用程序的外观图片:
正如您所看到的,用户将把 4 列设置为某些颜色,并且当他们按下“猜测”按钮时,它应该在下面的空间中显示 4 个猜测(在 ImageView 中或在画布中)。
预先感谢您提供的任何帮助:)
I have a UIPicker view containing 4 columns with the same array of 6 images in each column (colors). I have a button which, when pressed, will display the 4 images on the UIPickerView in separate views. Problem is, I can't seem to find a way to get the UIView from a UIPickerView.
Here is a picture of what the finished app will look like:
As you can see, the user will set the 4 columns to some colors and when they press the Guess button, it should display the 4 guesses in the space below (either in ImageViews or in a canvas).
Thanks in advance for any help you can offer :)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以通过调用 viewForRow:forComponent: 方法来获取特定视图的视图。
其他组件依此类推。
这里的问题是,您不能将其作为子视图添加到另一个视图,因为任何视图只能有一个超级视图。您应该获取可能用作数据源的颜色。
You can get the view for a particular view by calling
viewForRow:forComponent:
method.and so on for the other components.
The problem here is that you can't add it to another view as subview as there can be only one superview for any view. You should rather get the color which you might be using as the data source.