//首先,在头文件里遵循两个协议 <UIPickerViewDataSource,UIPickerViewDelegate> //数据源协议中两个必须的方法 //有多少部件 -(NSInteger)numberOfComponentsInPickerView:(UIPickerView*)pickerView{ return 2; } //每个部件有多少行 -(NSInteger)pickerView:(UIPickerView*)pickerView numbersOfRowsInComponent:(NSInteger)component{ if(component == 0 ){ return [activities count] } if(component == 1 ){ return [feelings count] } } //代理协议中只有一个必须的方法 -(NSString*)pickerView:(UIPickerView*)pickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component{ switch (component){ case 0: return [activities objectAtIndex:row]; case 1: return [feelings objectAtIndex:row]; } return nil; } //别忘了在interface builder 去连接代理