0
我有下面一段代碼:UITextbox和UIPickerView
-(IBAction)routePicker
{
UIView *myView = [[UIView alloc] initWithFrame:CGRectMake(0, 264, 320, 216)];
UIPickerView *thePickerView = [[UIPickerView alloc] initWithFrame:CGRectMake(0,0,320,216)];
thePickerView.dataSource = self;
thePickerView.delegate = self;
[myView addSubview:thePickerView];
[self.view addSubview:myView];
}
此創建UIPickerView,其中包含我添加預定義項的子視圖。
此時此IBAction被鏈接到一個自定義按鈕,所以當我點擊按鈕時,它會加載子視圖。我想要文本框而不是自定義按鈕。所以當我點擊/點擊文本框時,我的UIPickerView應該加載到子視圖中。
問候, 斯蒂芬
你想能夠編輯您的文本視圖這個例子嗎?如果是這樣,你的選擇器可能會被標準鍵盤隱藏起來...... – Vladimir 2010-07-12 14:35:27
不,我只是希望能夠從選取器中進行選擇並使其填充選擇的文本框。它不一定是一個文本,也許是一個標籤? – Stephen 2010-07-12 14:42:15