选择器视图出现问题
我正在使用双组件实现选择器视图,通过选择切换按钮来切换摄氏和华氏度两个选择器视图。两个选择器视图都在加载我的应用程序并获取切换。但我缺少我的组件值。请帮助我,这里我附上了我的选择器项目。
http://www.ziddu.com/download/13259414/TemperaturePicker.zip.html
I am implementing picker view with double component Toggle with Celsius and Fahrenheit two picker views by selecting toggle button. Both the picker view is loading my app and getting toggle . But i am missing my components values ., please help me , here i attached my picker project.
http://www.ziddu.com/download/13259414/TemperaturePicker.zip.html
我在您的代码中发现了两个问题:
在方法
updateLabel
中,您应该重新加载 pickerview:[pickerView reloadAllComponents];
你的
NSObject
-类Celsius
和Fahrenheit
不是ViewControllers,这意味着viewDidLoad
不会被执行并且包含数据的数组将不会被初始化。最好你写一个像这样的初始化程序:
I've found two problems in your code:
In the method
updateLabel
you should reload the pickerview:[pickerView reloadAllComponents];
Your
NSObject
-ClassesCelsius
andFahrenheit
are not ViewControllers, which means thatviewDidLoad
won't be executed and the array containing the data will not be initialized.Better you write an initializer like this: