【发布时间】:2014-11-03 11:52:16
【问题描述】:
我的故事板中有一个 UIPickerView。 包含它的 UIViewController 设置了接口声明
@interface ContactDetail : UIViewController <ABPeoplePickerNavigationControllerDelegate, UIPickerViewDataSource, UIPickerViewDelegate,UIAlertViewDelegate, UITextFieldDelegate>
关于视图加载,pickerview 委托集
pickerView_RelationshipType.dataSource=self;
pickerView_RelationshipType.delegate = self;
pickerView_RelationshipType.showsSelectionIndicator = YES;
所有 UIPickerView 数据源和委托方法都被触发,除了那些 2
pickerView:titleForRow:rowforComponent
and
pickerView:viewForRow:forComponent:reusingView
下面的都调用了,没问题
- (NSInteger)pickerView:(UIPickerView *)pickerView numberOfRowsInComponent:(NSInteger)component
- (NSInteger)numberOfComponentsInPickerView:(UIPickerView *)pickerView
- (void)pickerView:(UIPickerView *)pickerView didSelectRow: (NSInteger)row inComponent:(NSInteger)component
- (CGFloat)pickerView:(UIPickerView *)pickerView widthForComponent:(NSInteger)component
【问题讨论】:
-
感谢 iBhavin 和 JAL。我已经意识到我的 dataSource 从 coreData 返回 nil。问题解决了
标签: ios objective-c uipickerview uipickerviewdatasource uipickerviewdelegate