当我想将 UIPicker 分配为 UITextField 的 inputView 时遇到问题。它显示错误“分配给只读属性”。请帮忙,因为我认为这与财产合成无关。
我在下面添加了我的代码:
@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];
}
附截图:-