1
我遇到了一個UIPickerView一個奇怪的行爲旋轉:UIPickerView與日期只在一個方向
我試圖表現出動作片內的日期選擇器。 一切運轉良好,除了車輪首先在一個方向旋轉!
如果您開始向上旋轉並將方向改爲向下 - 它會起作用。但是當您嘗試開始旋轉時,選取器不會移動。
這裏是我的代碼:
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];