I have an iPad app, which has a action sheet called from a button. Im using the showFromRect for the actionSheet so it looks like a popOver. When the app first starts up the actionSheet never shows in the correct place until after the device is rotated at least once. After the device is rotated the actionSheet is in the correct place. my code is below.
-(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];
}
any help would greatly be appreciated.
This method shows the correct positioning whether or not the device has been rotated.