私はUIPickerView
でiPadにUIActionSheet
を表示しようとしていますが、私はUIPickerView
の代理人とデータソースの仕事をしていますが、-[UIActionSheet showFromRect:inView:animated:]
結果UIPopover
/UIActionSheet
が小さすぎてフレームサイズを設定できないようで、ボタンも表示されません。iPadフレームの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;
私は、[UIActionSheet setFrame:]が呼び出されているかどうかを少し実験しました。上記のイベントループの後に、iOSによって開始された別のイベントループと呼ばれる - [UIActionSheet setFrame:]が表示されている小さなフレームで呼び出されているようです。 –
この機能を使ってiPad上のポップオーバーを使ったほうがいいですか? AFAIK ActionSheetはボタン専用です。 – Eimantas