我想知道UIPickerView协议背后的概念,Objective C?

时间:2017-02-17 06:18:41

标签: objective-c syntax

-(NSString *)pickerView:(UIPickerView *)pickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component 

对于上述方法,-(NSString *)pickerView代表什么,(UIPickerView *)pickerView代表什么,在这些方面,pickerView的含义是什么?

-(NSInteger)pickerView:(UIPickerView *)pickerView numberOfRowsInComponent:(NSInteger)component,对这种方法也有同样的疑虑。  如果我知道这些内部协议方法,我将很高兴,帮助我。

2 个答案:

答案 0 :(得分:0)

// returns the number of 'columns' to display.
- (NSInteger)numberOfComponentsInPickerView:(UIPickerView *)pickerView;

// returns the # of rows in each component..
- (NSInteger)pickerView:(UIPickerView *)pickerView numberOfRowsInComponent:(NSInteger)component;

答案 1 :(得分:0)

在方法中:-(NSString *)pickerView:(UIPickerView *)pickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component

  • NSString是该方法的 return 类型。
  • (UIPickerView *)pickerView 实例变量的类类型。
  • 该方法命名为pickerView:titleForRow:forComponent