先写好这个plist
如图所示的连接一下线
用这个方法将plist中的数据存入到self.foods中
写好三个datasource方法
- (NSInteger)numberOfComponentsInPickerView:(UIPickerView *)pickerView
{
return self.foods.count;
//多少列
}
- (NSInteger)pickerView:(UIPickerView *)pickerView numberOfRowsInComponent:(NSInteger)component
{NSArray * subfoods = self.foods[component];
return subfoods.count;
//每列多少个
}
- (NSString * )pickerView:(UIPickerView *)pickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component
{
return self.foods[component][row];
//每一列的每一行显示的是什么
}