iphone - 如何在 UIDatePicker iphone 中只显示时间

标签 iphone objective-c uiactionsheet

在我的应用程序中,我通过代码在操作表中显示一个 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/

相关文章:

ios - iPad 中的 UIActionSheet 底部带有箭头

iphone - UISlider可用值

iphone - 以编程方式创建的 UIButton。如何将润色发送到 IBAction?

iphone - 为什么在NSArray上使用SQLite

objective-c - 使用 NSInputStream 读取动态增长的文件

ios - 显示 UIActionSheet 后,UIAlertView 未触发

iphone - 当应用程序从 iPhone 后台出现时,会调用什么方法?

iphone - RestKit 在核心数据中存储对象

ios - 如何在谷歌地图上显示搜索地址?

swift - 使用 ActionSheet 中的 Collection View 显示照片