- Home /
Question by
Ghisallo · Dec 22, 2015 at 07:30 PM ·
iosxcodeorientationnotifications
Move iOS Notification Center tab for landscape orientation restricted app in Unity 5
I have a similar issue to the one in this question. The answer there doesn't apply to Unity 5 apparently because it doesn't work. In fact, there is no IPhone_View.mm file created in the build.
To be more specific, my ios app is restricted to landscape left and right, and the Notification Center tab that will show up by dragging at the top of the screen sometimes interferes with the app. So I'd like to move it to one side or the other -- matters not which.
I've tried changing this line in Build\Classes\UI\UnityAppController+ViewHandling.mm:
[UIApplication sharedApplication].statusBarOrientation = orient;
to:
[[UIApplication sharedApplication] statusBarOrientation:UIInterfaceOrientationPortrait animated:NO];
and:
[UIApplication sharedApplication].statusBarOrientation;UIInterfaceOrientationLandscapeLeft;
Both of which give me errors in Xcode. Can anybody more knowledgeable in Xcode help me out?
Below is the entire method for context. Am I even barking up the right tree?
- (void)orientInterface:(UIInterfaceOrientation)orient
{
if(_curOrientation == orient && _rootController != _viewControllerForOrientation[0])
return;
if(_unityAppReady)
UnityFinishRendering();
[KeyboardDelegate StartReorientation];
[CATransaction begin];
{
UIInterfaceOrientation oldOrient = _curOrientation;
UIInterfaceOrientation newOrient = orient;
[self interfaceWillChangeOrientationTo:newOrient];
[self transitionToViewController:[self createRootViewControllerForOrientation:newOrient]];
[self interfaceDidChangeOrientationFrom:oldOrient];
[UIApplication sharedApplication].statusBarOrientation = orient; // original Unity generated code
// my failed attempts based on internet searches:
//[UIApplication sharedApplication].statusBarOrientation;UIInterfaceOrientationLandscapeLeft;
//[[UIApplication sharedApplication] statusBarOrientation:UIInterfaceOrientationPortrait animated:NO];
}
[CATransaction commit];
[KeyboardDelegate FinishReorientation];
}
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220612053546im_/https://answers.unity.com/themes/thub/images/avi.jpg)