如何在一个页面上区分多个uipickerviews

时间:2015-07-03 07:25:29

标签: swift uipickerview

  • 我在一个uiviewcontroller中有2个uipickerviews:

dropdown_1.frame = CGRectMake(...); dropdown_2.frame = CGRectMake(...);

  • 这两个下拉列表有2个不同的值数组
> arraySizes5 = [sverysmall, ssmall, snormal, slarge, sverylarge];

> arraySizes3 = [ ssmall, snormal, slarge];
  • 我的功能如下:

func numberOfComponentsInPickerView(pickerView: UIPickerView) -> Int {
    return 1
}

func pickerView(pickerView: UIPickerView, numberOfRowsInComponent component: Int) -> Int {
    return arraySizes5.count;  <<----- How to differentiate ??
}

func pickerView(pickerView: UIPickerView, titleForRow row: Int, forComponent component: Int) -> String! {
    return arraySizes5[row]
}

如何在函数pickerView中的2个下拉列表中添加相应的值?或者,如果有帮助,我该如何设置组件ID?

1 个答案:

答案 0 :(得分:2)

以下是您可以这样做的方式:

layout
相关问题