在我的应用程序中,我通过代码在操作表中显示UIDateTimePicker。它工作正常。
但是我不想显示日期和日期。如何做到这一点。
请帮忙。提前致谢。

码:

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];

最佳答案

datePicker.datePickerMode = UIDatePickerModeTime;

关于iphone - 如何在UIDatePicker iPhone中仅显示时间,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/6774020/

10-10 22:24