当前位置: 动力学知识库 > 问答 > 编程问答 >

iphone - How to make certain rows unselectable in uipicker

问题描述:

I am creating my own UIPickerview for dates as I need only Months and Days and do not want years, so I cannot use UIDatePicker. When different months are selected I cannot seem to replicate the way UIDatepicker gray's out the unavailable days. For example: when November is selected days 1-30 are selectable but 31 is not when using the UIDatepicker. Does anyone know how to replicate this and make certain row grayed out and unselectable.In uidatepicker unseletable option is there.So please help me.

网友答案:

Use uipickerview with two components.. se that example it may help you Link

or this link

网友答案:

When a month is selected in component 1 try to reload the picker view. Then in this method:

- (NSString *)pickerView:(UIPickerView *)pickerView titleForRow:(NSInteger)row     forComponent:(NSInteger)component;

try to set the

yourRow.isUserInteractionEnabled = NO;

I hope this helps you. Cheers!! Happy Coding!

分享给朋友:
您可能感兴趣的文章:
随机阅读: