Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
607 views
in Technique[技术] by (71.8m points)

iphone - UIDatePicker show only month and day

I'd like to have a UIDatePicker where the user can pick a month and a day but not the year. I'm aware that leap years have an extra day, so for simplicity, let's throw that day away.

Is there any way to remove the year column or have 2 reels with month/day that act like the UIDatePicker (grey out days that don't exist in the selected month)?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

You cannot use the UIDatePicker class as it stands to do this - The UIDatePicker only supports the following modes

typedef enum {
   UIDatePickerModeTime,
   UIDatePickerModeDate,
   UIDatePickerModeDateAndTime,
   UIDatePickerModeCountDownTimer
} UIDatePickerMode;

Create a view and controller that implement the UIPickerViewDelegate and create your own - you may find a little more detail here Fixed labels in the selection bar of a UIPickerView


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...