【问题标题】:Cannot add a UIDatePicker to UIActionSheet无法将 UIDatePicker 添加到 UIActionSheet
【发布时间】:2011-10-04 02:16:41
【问题描述】:

我想在 UIActionSheet 中添加一个 UIDatePicker,代码如下:

UIActionSheet* actionSheet = [[UIActionSheet alloc] initWithTitle:@"DEMO" delegate:self cancelButtonTitle:@"Cancle" destructiveButtonTitle:nil otherButtonTitles:nil];


 actionSheet = [[UIActionSheet alloc] initWithTitle:@"Ratings" 
                                                  delegate:self
                                         cancelButtonTitle:@"Cancel"
                                    destructiveButtonTitle:nil
                                         otherButtonTitles:nil];

UIDatePicker *pickerView = [[UIDatePicker alloc] init];
pickerView.datePickerMode = UIDatePickerModeDate;

[actionSheet addSubview:pickerView];
[actionSheet showInView:self.view];   
[actionSheet sendSubviewToBack:pickerView];  

[actionSheet showInView:self.view];
[actionSheet setBounds:CGRectMake(0,0,320, 500)];

CGRect pickerRect = pickerView.bounds;
pickerRect.origin.y = -100;
pickerView.bounds = pickerRect;

[pickerView release];
[actionSheet release];

问题是为什么这段代码不能在 iPad 模式下运行,而在 iphone 模式下可以运行

【问题讨论】:

  • 你得到答案了吗?

标签: ios uipickerview uidatepicker uiactionsheet


【解决方案1】:

我会尝试使用EAActionSheetPicker。它会为您处理。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2010-09-25
    • 1970-01-01
    • 1970-01-01
    • 2011-08-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-03-05
    相关资源
    最近更新 更多