views:

32

answers:

0

I got a strange behavior with an UIPickerView:

I try to show an Date Picker within an action sheet. Everything works well, except that the wheels are only rotating in one direction at first!

If you start rotating up and change the direction to down - it works. But when you try to start rotating down, the picker won't move.

Here is my code:

UIActionSheet *menu = [[UIActionSheet alloc] initWithTitle:@"Date Picker" 
                                                  delegate:self
                                         cancelButtonTitle:@"Abbrechen"
                                    destructiveButtonTitle:nil
                                         otherButtonTitles:@"Auswählen",nil];    
    // Add the picker
    UIDatePicker *tmpPickerView = [[UIDatePicker alloc] init];
    tmpPickerView.datePickerMode = UIDatePickerModeDate;

    [tmpPickerView addTarget:self
    action:@selector(pickerChanged:)
    forControlEvents:UIControlEventValueChanged]; 

    [menu addSubview:tmpPickerView];              
    [menu showInView:self];        

    CGRect menuRect = menu.frame;
    menuRect.origin.y -= 214;
    menuRect.size.height = 300;
    menu.frame = menuRect;

    CGRect pickerRect = pickerView.frame;
    pickerRect.origin.y = 174;
    pickerView.frame = pickerRect;

    [tmpPickerView release];    
    [menu release];