Ho personalizzato UIDatePicker a un livello e lo aggiungo a UIAlertView.Personalizzazione UIDatePicker
ma sto ottenendo un colore nero nella parte inferiore e la parte superiore del calendario, come rimuoverlo. Voglio che il selezionatore di date sia pulito e ordinato.
Il codice che uso per raggiungere questo obiettivo:
UIDatePicker *datePicker = [[UIDatePicker alloc] init];
datePicker.frame=CGRectMake(20, 45.0, 240.0, 150.0);
datePicker.minimumDate=[NSDate date];
//Forget about this logic.
NSString *[email protected]"";
if(self.presentingViewController !=nil)
{
[email protected]"Select Date and Time";
[datePicker setDatePickerMode:UIDatePickerModeDateAndTime];
}
else
{
[email protected]"Select Time";
[datePicker setDatePickerMode:UIDatePickerModeTime];
}
[datePicker setDate:[NSDate date]];
UIView *view = [[datePicker subviews] objectAtIndex:0];
[view setBackgroundColor:[UIColor clearColor]]; // hide the first and the last subviews
[[[view subviews] objectAtIndex:0] setHidden:YES];
[[[view subviews] lastObject] setHidden:YES];
UIAlertView *eventStartDateAlert = [[UIAlertView alloc] initWithTitle:alertTitleString message:@"\n\n\n\n\n\n\n\n" delegate:self cancelButtonTitle:NSLocalizedString(@"OK", @"Ok") otherButtonTitles:nil];
eventStartDateAlert.delegate = self;
[eventStartDateAlert addSubview:datePicker];
[eventStartDateAlert show];
come Didi si fatto che può condividere alcuni esempi di codice qui plz –
@KAREEMMAHAMMED Vedere la mia modifica. – satheeshwaran
Penso che ciò non sia possibile con iOS 6, UIDatePicker non è una sottoclasse di UIPickerView. –