选择器,设置启动/默认行? [英] Picker, setting startup / default row?

查看:86
本文介绍了选择器,设置启动/默认行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有人知道一种方式,我可以设置我的选择器默认/启动与行值不正确的数据源的开始?如果可能,我想让选择器以一个中间值开始,这样我就不会在顶部得到空白的白色区域。





EDIT_001



添加了以下行到viewDidLoad,这似乎是正在建立UI时调用这些行的最佳位置。

  [doublePicker selectRow:2 inComponent:kCoffeeIndex animated:NO]; 
[doublePicker selectRow:2 inComponent:kCakeIndex animated:NO];

gary

解决方案

使用-selectRow:inComponent:animated:


Does anyone know a way that I can set my picker to default / startup with row values that are not right at the start of my datasource? If possible I would like the picker to start with a middle value so I don't get the blank white area at the top.

EDIT_001

Added the following lines to viewDidLoad, which seems to be the best place to call these as the UI is being built.

[doublePicker selectRow:2 inComponent:kCoffeeIndex animated:NO];
[doublePicker selectRow:2 inComponent:kCakeIndex animated:NO];

gary

解决方案

Use -selectRow:inComponent:animated: for that.

这篇关于选择器,设置启动/默认行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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