UI Datepicker range. iPhone

前端 未结 1 1875
感动是毒
感动是毒 2021-01-24 20:38

I have a datePickerView which I want it to have a min date = current time, max date = 48hrs later. It\'s currently working fine, as I can\'t pick out of that range. But there\'s

相关标签:
1条回答
  • 2021-01-24 21:13

    This is default behavior when you set a minimum date and a maximum date and APPLE does it clearly to make it obvious that they are not selectable.

    What you can do is implement a UIPickerView for the dates and implement viewForRow for the pickerView methods.

    - (UIView *)pickerView:(UIPickerView *)pickerView viewForRow:(NSInteger)row forComponent:(NSInteger)component reusingView:(UIView *)view{
    UILabel* tView = (UILabel*)view;
    if (!tView){
        tView = [[UILabel alloc] init];
    
        // Add label.text which is the picker value for the row (for that component)
    
        // set the font for the label as black.
    
    }
    

    You can also change the font size of the values in the pickerView.

    0 讨论(0)
提交回复
热议问题