横向模式下UIActionSheet上的UIPickerView显示为黑屏

时间:2012-09-13 18:41:51

标签: objective-c ios uipickerview landscape uiactionsheet

我有一个应用程序,我通过UIActionSheet更新表行。在工作表上我提出了一个UIPickerView。 UIPickerView在iPhone上的肖像效果很好。但是当我以横向模式启动它时,它仍然有效,但是轮廓区域显示为黑色而未选择的数字也是黑色。

下面是截图和代码。有什么明显的错误吗?

enter image description here

// create enough space for the UIPicker to show up above the selection button
NSString *title = @"\n\n\n\n\n\n\n\n\n\n\n\n";

if ((UIDeviceOrientationIsLandscape([UIDevice currentDevice].orientation)) &&
    (UI_USER_INTERFACE_IDIOM() != UIUserInterfaceIdiomPad)) {
    title = @"\n\n\n\n\n\n\n\n\n";
}


UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle:title delegate:self cancelButtonTitle:nil destructiveButtonTitle:nil otherButtonTitles:NSLocalizedString(@"Choose", @"Click to finilize Value - Timer"), nil];
[actionSheet showInView:viewController.view];

UIDatePicker *pickerView = [[UIDatePicker alloc] init];
[pickerView setDatePickerMode: UIDatePickerModeCountDownTimer];
if (timerInterval == 0) timerInterval = 5;
[pickerView setMinuteInterval: timerInterval];
[pickerView setCountDownDuration: [timerRec.timerDuration intValue]];

pickerView.tag = 101;

if ((UIDeviceOrientationIsLandscape([UIDevice currentDevice].orientation)) &&
    (UI_USER_INTERFACE_IDIOM() != UIUserInterfaceIdiomPad)) {
    pickerView.frame = CGRectMake(0,0, 50,50);
}

//pickerView.delegate = self;
//pickerView.dataSource = self;
//ickerView.showsSelectionIndicator = YES;

[actionSheet addSubview:pickerView];

0 个答案:

没有答案