如何UIPickerView
在不使用 Interface Builder 的情况下以编程方式设置视图?UIPickerView
当我从第一个UIPickerView
,第二个UIPickerView
更改这些值中选择一个值时,也无法理解如何做两个?第一个UIPickerView
国家和第二个UIPickerView
城市。
问问题
467 次
2 回答
0
参考以下链接,
http://gabriel-tips.blogspot.in/2011/04/uipickerview-add-it-programmatically_04.html http://developer.apple.com/library/ios/#documentation/UIKit/Reference/UIPickerView_Class/index。 html http://www.edumobile.org/iphone/iphone-programming-tutorials/how-to-implement-pickerview-programmatically-in-iphone/
对于两个选择器视图,您可以使用标签值或将其放入属性中。
于 2013-06-26T13:42:59.420 回答
0
Yes possible you can create array on city within country like
int select=0;
(
india
(
city,
.....,
)
Australia
(
City,
......,
)
)
and use
picker
- (NSInteger)pickerView:(UIPickerView *)pickerView numberOfRowsInComponent:(NSInteger)component
{
if(picker==1)
{
return [arr_counry count];
}
else if(picker==2)
{
return [[arr_counry objectAtIndex:select] count];
}
}
- (void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component
{
if(picker==1)
{
select=[arr_currency objectAtIndex:row];
[picker reloadAllComponents];
}
else if(picker==2)
{
}
}
于 2013-06-27T05:38:37.873 回答