在我的應用程序中,我通過代碼在操作表中顯示UIDateTimePicker
。它工作正常。 但我不想顯示日期和日期。如何做到這一點。 請幫忙。提前致謝。如何在UIDatePicker中僅顯示時間iphone
代碼:
UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle:NSLocalizedString(@"Select Date",@"Selecte Date")delegate:self cancelButtonTitle:NSLocalizedString(@"Done",@"Done")
destructiveButtonTitle:NSLocalizedString(@"Cancel",@"Cancel")
otherButtonTitles:nil];
actionSheet.actionSheetStyle = UIActionSheetStyleBlackTranslucent;
UIDatePicker *datePicker = [[UIDatePicker alloc] initWithFrame:CGRectMake(0, 50, 320, 270)];
//datePicker.showsSelectionIndicator = YES;
// datePicker.dataSource = self;
//datePicker.delegate = self;
[actionSheet addSubview:datePicker];
[datePicker release];
[actionSheet showInView:self.view];
[actionSheet setBounds:CGRectMake(0, 0, 320, 500)];
[actionSheet release];
非常感謝,它爲我工作。 – ishhhh
@ishhh:多數民衆贊成在..如果它有幫助接受答案。 –
將日期選擇器顯示爲UIActionSheet的子視圖。然後你可以使用來自UIActionSheetDelegate的didDismissWithButtonIndex委託來解除日期選擇器 –