How do I keep keep my view from displaying off screen in iOS7?

144 Views Asked by At

We are updating our app to work with iOS7 and have had a lot of trouble with orientation and the placement of our views.

We are using views that display a list that goes from

Categories->Location->Location Information.

The Location and Location Information views have a back button on them to go to the previous screen. However, whenever the back button is pushed the view is being centered somewhere off screen. I know this because I have used the Reveal application (revealapp.com) to see where the views are positioned as I run it on my iPhone.

When the view is correctly positioned on screen its container views center is set at (X: 160, Y:240)

But when I push the back button the view is positioned in the opposite corner and the container views coordinates are now set to (X: 160, Y:720.)

Any idea what could be causing this?

Our UI needs to work in Landscape mode specifically and we have had all sorts of issues preserving that orientation with the iOS7 upgrade.

Any assistance or clues would be appreciated.

I'm including the script that seems to be controlling the orientation.

/*
 *  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);
}
0

There are 0 best solutions below