gpt4 book ai didi

ios - UIPickerView pickerView :titleForRow:rowforComponent method not called

转载 作者:行者123 更新时间:2023-12-01 17:30:24 26 4
gpt4 key购买 nike

我的 Storyboard中有一个 UIPickerView。包含它的 UIViewController 设置了接口(interface)声明

@interface ContactDetail : UIViewController <ABPeoplePickerNavigationControllerDelegate, UIPickerViewDataSource, UIPickerViewDelegate,UIAlertViewDelegate, UITextFieldDelegate>

on view Load, pickerview委托(delegate)集

pickerView_RelationshipType.dataSource=self;
pickerView_RelationshipType.delegate = self;
pickerView_RelationshipType.showsSelectionIndicator = YES;

除那两个之外,所有 UIPickerView 数据源和委托(delegate)方法都被触发

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

最佳答案

numberOfComponentsInPickerView 中有什么?

如果您的 numberOfRows 返回 0,那么您的委托(delegate)方法将永远不会被调用 - 如果选择器认为没有任何行要显示,则它不会询问行的标题。

关于ios - UIPickerView pickerView :titleForRow:rowforComponent method not called,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26713736/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com