1
我有一個表格單元格,我將其contentView設置爲包含一個標籤和一些uipickerviews的自定義視圖。我的問題是隻有第一個選擇器視圖是可選的,而其餘的都不是。當我點擊任何不可選擇的選取器視圖時,表格單元格會被選中。下面是我的代碼:uipickerviews裏面的表單元格不可選
// Inside cellForRowAtIndexPath:
CustomPickerView *customView = [[CustomPickerView alloc] initWithFrame:CGRectMake(0, 0,
cell.frame.size.width, 84) andCustomObject:customObject];
[customView setPickerViewSelection:@""];
[cell.contentView addSubview:customView];
[customView release];
// Inside CustomPickerView's initWithFrame:andCustomObject method:
for (...) {
UIPickerView *tempPickerView = [[UIPickerView alloc] initWithFrame:CGRectMake(25 +
size.width,yPosition + 42, 320, frame.size.height - 22)];
self.pickerView = tempPickerView;
[tempPickerView release];
self.pickerView.delegate = self;
self.pickerView.dataSource = self;
self.pickerView.showsSelectionIndicator = YES;
CGAffineTransform t0 = CGAffineTransformMakeTranslation(pickerView.bounds.size.width/2, pickerView.bounds.size.height/2);
CGAffineTransform s0 = CGAffineTransformMakeScale(0.4, 0.5);
CGAffineTransform t1 = CGAffineTransformMakeTranslation(-pickerView.bounds.size.width/2, -pickerView.bounds.size.height/2);
self.pickerView.transform = CGAffineTransformConcat(t0, CGAffineTransformConcat(s0, t1));
[self addSubview:pickerView];
}
我也嘗試創建的拾取意見,而不只是一個選擇器視圖數組的路線,但它並沒有區別,因爲當你添加的選擇器視圖作爲一個子視圖這是有道理的,這個選擇器視圖會被保留下來,所以最後我總是會在自定義視圖(自定義視圖將被添加到表格單元格的內容視圖)中獲得x個選擇器視圖。
感謝, 米哈伊
我在父視圖(我添加所有選擇器視圖)上設置屬性,實際上只有第一個選擇器視圖可見。謝謝! – 2010-07-21 14:40:22