gpt4 book ai didi

iPhone UITextField inputView 错误 : Assignement to readonly property

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

当我想将 UIPicker 分配为 UITextField 的 inputView 时遇到问题。它显示错误“ 分配给只读属性 ”。请帮忙,因为我认为这与属性(property)合成无关。

我在下面添加了我的代码:

@interface DriverWaitingDetails : UIViewController<UITextFieldDelegate,UIPickerViewDataSource, UIPickerViewDelegate>
{

IBOutlet UILabel *baseLabel;
IBOutlet UITableView *driverTableView;
IBOutlet UIPickerView *basePicker;
}

@property(nonatomic, retain) IBOutlet UIPickerView *basePicker;
@property(nonatomic,retain)IBOutlet UILabel *baseLabel;
@property(nonatomic,retain)IBOutlet UITableView *driverTableView;


@end

实现代码:-
-(void)viewDidLoad
{

basePicker=[[UIPickerView alloc] initWithFrame:CGRectMake(0,100,320, 500)];
self.navigationItem.title=@"Driver Table";
baseLabel.userInteractionEnabled = YES;
basePicker.delegate = self;
basePicker.dataSource = self;
[basePicker setShowsSelectionIndicator:YES];
baseLabel.inputView=nil;
[super viewDidLoad];
}

附截图:-
UITextField Error Image

最佳答案

您正在设置 UILabel 的输入 View .
您将 baseLabel 声明为 UILabel不是 UITextField .

IBOutlet UILabel *baseLabel;

关于iPhone UITextField inputView 错误 : Assignement to readonly property,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13285177/

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