我们正在更新我们的应用程序以与 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);
}