我们正在更新我们的应用程序以使用iOS7,并且在方向和视图位置方面遇到了很多麻烦。
我们正在使用显示来自
的列表的视图类别 - >位置 - >位置信息。
位置和位置信息视图上有一个后退按钮,可以转到上一个屏幕。但是,每当按下后退按钮时,视图就会在屏幕上的某个位置居中。我知道这是因为我使用了Reveal应用程序(revealapp.com)来查看我在iPhone上运行它时视图的位置。
当视图在屏幕上正确定位时,其容器视图中心设置为(X:160,Y:240)
但是当我按下后退按钮时,视图位于对角,容器视图坐标现在设置为(X:160,Y:720。)
知道可能导致这种情况的原因是什么?
我们的UI需要专门在横向模式下工作,我们遇到了各种各样的问题,保留了iOS7升级的方向。
任何帮助或线索都将受到赞赏。
我包含了似乎正在控制方向的脚本。
/*
* Portable.cpp
* Unity-iPhone
*
* Created by macmini on 8/25/10.
* Copyright 2010 __MyCompanyName__. All rights reserved.
*
*/
#include "UnityAppController.h"
#include "Portable.h"
#include "RootViewController.h"
#include "DBConnection.h"
#import "DeviceID.h"
#ifdef USE_FRONT_END_CTRLR
#import "FBFrontendController.h"
#endif
extern UIWindow *uiWindow;
void UnityPause(bool pause);
RootViewController *controller;
bool unityPaused = false;
bool inDesiredOrientation = false;
@implementation UINavigationController (Rotation_IOS6)
-(BOOL)shouldAutorotate
{
UIInterfaceOrientation o = self.interfaceOrientation;
UIInterfaceOrientation ob = [UIDevice currentDevice].orientation;
if (ob == UIDeviceOrientationLandscapeRight && o == UIDeviceOrientationLandscapeRight)
inDesiredOrientation = true;
if (ob == UIDeviceOrientationLandscapeRight)
return YES;
if (inDesiredOrientation)
return NO;
if (o == UIDeviceOrientationLandscapeRight)
return YES;
return NO;
}
@end
extern "C" void PauseUnity() {
unityPaused = true;
UnityPause(true);
}
extern "C" void ResumeUnity() {
unityPaused = false;
UnityPause(false);
}
bool UnityPaused() {
return unityPaused;
}
extern "C" void ShowModalUI()
{
UnityPause(true);
if (uiWindow==nil)
{
UIScreen *MainScreen=[UIScreen mainScreen];
UIScreenMode *ScreenMode=[MainScreen currentMode];
CGSize sSize=[ScreenMode size];
NSString *deviceType = [UIDevice currentDevice].model;
NSString *platformStr = [[DeviceID sharedDeviceID] platformString];
CGRect windowFrame;
if([deviceType isEqualToString:@"iPhone"]) {
windowFrame = CGRectMake(0,0,sSize.width, sSize.height);
} else {
windowFrame = CGRectMake(0,0,sSize.height, sSize.width);
}
uiWindow = [[[UIWindow alloc] initWithFrame: windowFrame] retain];
[uiWindow makeKeyAndVisible];
controller = [RootViewController sharedRootView];
//controller.delegate = mainController;
UINavigationController *naviController = [[UINavigationController alloc] initWithRootViewController:controller];
//[controller release];
[[naviController navigationBar] setBarStyle:UIBarStyleBlack];
naviController.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
//[mainController presentModalViewController:navController animated:YES];
[DBConnection openConnection];
[uiWindow addSubview:naviController.view];
//[naviController release];
[controller retain];
//[naviController retain];
uiWindow.rootViewController = naviController;
}
else {
[uiWindow setHidden:NO];
[uiWindow makeKeyAndVisible];
}
}
extern "C" void ShowStore(const char *storeName) {
#if USE_FRONT_END_CTRLR==1
if (strncmp(storeName, "Day ", 4) == 0) {
char *s = (char *) malloc(strlen(storeName) + 1);
strcpy(s, storeName);
NSString *storeNameStr = [[NSString stringWithCString:s encoding:NSUTF8StringEncoding] retain];
[[FBFrontendController sharedFrontEndController] ShowDetailViewOf:storeNameStr];
} else
#endif
{
ShowModalUI();
UnityPause(true);
[uiWindow setHidden:NO];
[uiWindow makeKeyAndVisible];
char *s = (char *) malloc(strlen(storeName) + 1);
strcpy(s, storeName);
[controller ShowStoreByName:s];
}
//[[FBFrontendController sharedFrontEndController] popupDetail];
return;
}
//#ifndef USE_FRONT_END_CTRLR
//extern "C" void _showHTMLGuide() {
//}
//#endif
extern "C" void ShowStore_(const char *storeName) {
ShowStore(storeName);
}