我正在尝试在iPad上显示一个带有UIPickerView的UIActionSheet,我已经为iPhone编写了等效代码,因此我的UIPickerView委托和数据源都能正常工作,但是当我在iPad上使用-[UIActionSheet showFromRect:inView:animated:]时,结果的UIPopover/UIActionSheet太小了,而且我似乎无法设置框架大小,也没有任何按钮显示。
我不知道这是否是因为它们超出了范围还是因为其他原因。这是我删除所有非必要代码(iPhone等)后的代码样子。有人知道我做错了什么吗?有人知道任何示例吗?
CGRect thePickerFrame = CGRectMake(0, 0, 320.0, 485.0);
UIPickerView * thePickerView = [[UIPickerView alloc] initWithFrame:thePickerFrame];
[pickerActionSheet release], pickerActionSheet =
[[UIActionSheet alloc] initWithTitle:@"Choose" delegate:self
cancelButtonTitle:@"Cancel"
destructiveButtonTitle:nil
otherButtonTitles:@"Next", nil];
thePickerView.showsSelectionIndicator = YES;
thePickerView.dataSource = self;
thePickerView.delegate = self;
[pickerActionSheet addSubview:thePickerView];
[thePickerView selectRow:0 inComponent:0 animated:NO];
[thePickerView release];
[pickerActionSheet showFromRect:currentTextField.bounds
inView:currentTextField animated:NO];
pickerActionSheet.frame = thePickerFrame;