所以我的UIPickerView沒有連接到數據源。我不知道爲什麼。UIPickerView沒有連接到數據源
我使用UIPickerViewDelegate
和UIPickerViewDataSource
創建了一個文件,並正確地執行了在觸摸textField時引入UIPickerView的過程。
pickerView的工作原理,但不顯示任何組件。我實施了
-(NSInteger)numberOfComponentsInPickerView:(UIPickerView *)pickerView
{
return 3;
}
- (NSInteger)pickerView:(UIPickerView *)thePickerView numberOfRowsInComponent:(NSInteger)component
- (NSString *)pickerView:(UIPickerView *)thePickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component {
- (void)pickerView:(UIPickerView *)thePickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component {
- (CGFloat)pickerView:(UIPickerView *)pickerView widthForComponent:(NSInteger)component{
任何想法爲什麼pickerView沒有連接到DataSource?我也試過所有這些方法的NSLogging。 // Does not print
我還設置
packSizePopPickerView.delegate = self;
packSizePopPickerView.dataSource = self;
packSizePopPickerView = [[UIPickerView alloc] init];
你設置'delegate'和''你的UIPickerView'性能dataSource'? – albertamg
你設置委託和數據源的方法是什麼?在IB或代碼中創建選擇器視圖?並且不要創建新帖子 - 如果您需要添加更多信息,請修改帖子。 – thomashw
我在cellForRowAtIndexPath中設置它,因爲我需要它出現在UITableViewCell中的textField ....事情是..我有另一個視圖,它實現了SAME pickerView,它工作。爲什麼這不起作用! ? :( – Legolas