4

次のコードを使用して、アクション シートで datepicker を実装しています。

-(void)popupActionSheetWithDatePicker {

UIActionSheet *sheet = [[UIActionSheet alloc] initWithTitle:nil delegate:self cancelButtonTitle:nil destructiveButtonTitle:nil otherButtonTitles:@"Done",nil];

UIDatePicker *picker = [[UIDatePicker alloc] init];
self.datePicker = picker;
[self.datePicker setDatePickerMode:UIDatePickerModeDate];
[sheet addSubview:self.datePicker];
[sheet showInView:self.view];

[sheet setBounds:CGRectMake(0,0, 320,500)];

CGRect pickerRect = self.datePicker.bounds;
pickerRect.origin.y = -80;
self.datePicker.bounds = pickerRect;

[sheet bringSubviewToFront:self.datePicker];

[picker release];
[sheet release];   }

これで、ピッカーがポップアップし、選択インジケーターの下を除いて完全に機能します。

つまり、選択インジケーターの上と上では日付、月、年を選択できますが、その選択インジケーターの下では何も選択できず、無効になっています。

原因も解決策も見つかりません。

可能であれば、UIActionsheet コードを使用して動作する Datepicker を送信してください。

前もって感謝します。

4

2 に答える 2

0

I had this problem also , i supose you have an UIToolbar behind the picker. Just do

[self.navigationController setToolbarHidden:YES];

while in picker , then

[self.navigationController setToolbarHidden:NO];

hope this help

于 2010-03-04T05:57:33.870 に答える