jjzjj

UIDatePickerView

全部标签

ios - 如何在 UIDatePickerView 中隐藏 future 或过去的日期

我想设计一个用于设置出生日期的UI。为此,我选择了UIDatePickerView。现在我想将日期限制在01-01-1990和当前日期之间。它不应显示future日期和过去日期。目前我正在使用以下代码:NSDateComponents*components=[[NSDateComponentsalloc]init];[componentssetYear:1900];pickerView.datePicker.minimumDate=[[NSCalendarcurrentCalendar]dateFromComponents:components];pickerView.datePick

ios - 如何在横向旋转中使用自动布局调整 UIPickerView/UIDatePickerView 的高度?

当我的应用程序处于横向View时,我希望将UIPickerView/UIDatePickerView的高度调整为162。有没有一种简单的方法可以在代码的自动布局中执行此操作?我目前正在尝试以下处理调整大小的方法:-(void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientationduration:(NSTimeInterval)duration{NSIntegerheight=216;if(UIInterfaceOrientationIsLandscape(toIn