本文介绍了如何在UIDatePicker iPhone中仅显示时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在我的应用中,我通过代码在操作表中显示UIDateTimePicker
.它工作正常.但是我不想显示日期和日期.如何做到这一点.请帮忙.预先感谢.
In my app i am displaying a UIDateTimePicker
in action sheet through code. it is working fine.But i don't want to display date and day.How this can be done.Please help. Thanks in advance.
代码:
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;
这篇关于如何在UIDatePicker iPhone中仅显示时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!