我有問題,當我想分配UIPicker作爲UITextField的inputView。它顯示錯誤「分配給只讀屬性」。請幫忙,因爲我認爲這與財產合併無關。iPhone 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)];
[email protected]"Driver Table";
baseLabel.userInteractionEnabled = YES;
basePicker.delegate = self;
basePicker.dataSource = self;
[basePicker setShowsSelectionIndicator:YES];
baseLabel.inputView=nil;
[super viewDidLoad];
}
附截圖: -
好的......我剛剛意識到自己的錯誤。我覺得自己很愚蠢。還是要謝謝你的幫助。 – user1288005