2014-07-26 141 views
0

在我的應用程序,我想顯示過期日期其格式是「M/yyyy」意味着10/2014使用默認UIDatePicker控制器的幫助是可能的嗎?如何在UIDatePicker中僅顯示月份和年份?

+0

類似的,http://stackoverflow.com/questions/3348247/uidatepicker-select-month-and-year –

回答

0

您需要製作自己的自定義類。由於UIDatePicker不提供任何api來執行此操作。您需要製作自定義選取器並使用適當的數據源進行填充。此code將幫助您做同樣的事情。

+0

如何在UIDatePicker Controller中設置最近的日期和最大日期來隱藏前面的年份和月份? – bhavik

+0

@bhavik是的,你可以。你需要在'pickerView:(UIPickerView *)pickerView viewForRow:(NSInteger)row forComponent:'method.Check the month and year if it than now current date month and year disable it or do不按要求顯示 – codester

相關問題