ボタンから呼び出されるアクションシートを備えたiPadアプリを持っています。actionSheetにshowFromRectを使用しているので、popOverのように見えます。アプリを最初に起動したとき、デバイスが少なくとも1回回転するまで、actionSheetが正しい場所に表示されることはありません。デバイスを回転させた後、actionSheetは正しい場所にあります。私のコードは以下の通りです。
-(IBAction)showMenu
{
UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle:@"Copy To The Clipboard" delegate:self cancelButtonTitle:@"Cancel" destructiveButtonTitle:nil otherButtonTitles:@"Term & Definition",@"Term",@"Definition", nil];
UIDevice *thisDevice = [UIDevice currentDevice];
CGRect myImageRect;
if(thisDevice.orientation==UIDeviceOrientationPortrait){myImageRect = CGRectMake(300.0f, 950.0f, 320.0f, 175.0f);NSLog(@"P");} //Portait Mode
else if(thisDevice.orientation==UIDeviceOrientationPortraitUpsideDown){myImageRect = CGRectMake(300.0f, 950.0f, 320.0f, 175.0f);NSLog(@"PUD");}//Portait Mode UpsideDown
else if(thisDevice.orientation==UIDeviceOrientationLandscapeLeft){myImageRect = CGRectMake(300.0f, 700.0f, 320.0f, 175.0f);NSLog(@"LL");}//Landscape Mode Left
else if(thisDevice.orientation==UIDeviceOrientationLandscapeRight){myImageRect = CGRectMake(300.0f, 700.0f, 320.0f, 175.0f);NSLog(@"LR");}//Landscape Mode Right
[actionSheet showFromRect:myImageRect inView:self.view animated:YES];
[actionSheet release];
}
どんな助けでも大歓迎です。