フラグ enableRotation=1 の場合にのみインターフェイスを変更できるようにしたいと考えています。私はすべての回転方法をいじっていますが、どこにも行きません。
- (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation
{
enableRotation=0;
currentOrientation=fromInterfaceOrientation;
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
NSLog(@"enable rotation call %i\n",enableRotation);
if(enableRotation)
{
if ((interfaceOrientation== UIInterfaceOrientationPortrait) ||
(interfaceOrientation == UIInterfaceOrientationLandscapeLeft)
||(interfaceOrientation == UIInterfaceOrientationPortraitUpsideDown)||(interfaceOrientation == UIInterfaceOrientationLandscapeRight)
)
{
return YES;
}
}
else if (interfaceOrientation==currentOrientation){
return YES;
}
return NO;
}
これは、代替ビューを表示するために使用しているものです....
- (void)orientationChanged:(NSNotification *)notification
{
if (UIDeviceOrientationIsPortrait(deviceOrientation))
{
[self performSegueWithIdentifier:@"DisplayAlternateView" sender:self];
isShowingLandscapeView = NO;
// enableRotation=0;
NSLog(@"Rotation disabled\n");
}
else if (UIDeviceOrientationIsLandscape(deviceOrientation) &&
!isShowingLandscapeView)
{
[self dismissViewControllerAnimated:YES completion:nil];
isShowingLandscapeView = YES;
// enableRotation=0;
NSLog(@"Rotation disabled Change to Landscape\n");
}
}