目前需要添加一個PickerView,但是運行之後只有黑屏,不知道問題出在哪裡?
UIPickerView *myPickerView = [[UIPickerView alloc] initWithFrame:CGRectMake(0, 0, 320, 320)];
[self.view addSubview:myPickerView];
謝謝指點。
用UIPickerViewDataSource方法:
– numberOfComponentsInPickerView:
– pickerView:numberOfRowsInComponent:
還有UIPickerViewDelegate方法:
– pickerView:titleForRow:forComponent:
然後設置properties:
UIPickerView * myPickerView = [[UIPickerView alloc] initWithFrame:CGRectMake(0, 0, 320, 320)];
myPickerView.delegate = self;
myPickerView.dataSource = self;
[self.view addSubview:myPickerView];
在.h文件中,如下:
<UIPickerViewDelegate, UIPickerViewDataSource>
我以前是用NSMutableArray充填字符串,希望對你有用。