2015-01-05 2 views
1

Ok попробовал почти все, и он не работал.IOS Landscape Mode не работает OPEN GL

мне нужен двигатель для запуска в режиме LandscapeRight, поэтому я называю:

// 
[[UIApplication sharedApplication] setStatusBarOrientation:UIInterfaceOrientationLandscapeRight animated:NO]; 

Проблема в том, что остальные не поворачивается вообще,

enter image description here

мне удалось поверните вид, используя:

[pExternViewController setTransform:CGAffineTransformMakeRotation(M_PI/2.0f)]; 

Но это действительно так. esn't работа, как и ожидалось, размер буфера кадров является правильным в настоящее время:

FrameBuffer: ширина: 960, высота: 640

Тем не менее вы можете видеть это не 960x640, и я не могу выяснить почему?

enter image description here

ответ

1

Ok, наконец, сделал это. enter image description here

Сначала добавьте этот ключ в файл Plist (обязательно)

<key>UILaunchStoryboardName</key> 
<string>Launch Screen</string> 

определения размера экрана

#define SCREEN_WIDTH (IOS_VERSION_LOWER_THAN_8 ? (UIInterfaceOrientationIsPortrait([UIApplication sharedApplication].statusBarOrientation) ? [[UIScreen mainScreen] bounds].size.width : [[UIScreen mainScreen] bounds].size.height) : [[UIScreen mainScreen] bounds].size.width) 

#define SCREEN_HEIGHT (IOS_VERSION_LOWER_THAN_8 ? (UIInterfaceOrientationIsPortrait([UIApplication sharedApplication].statusBarOrientation) ? [[UIScreen mainScreen] bounds].size.height : [[UIScreen mainScreen] bounds].size.width) : [[UIScreen mainScreen] bounds].size.height) 

#define IOS_VERSION_LOWER_THAN_8 (NSFoundationVersionNumber <= NSFoundationVersionNumber_iOS_7_1) 

инициализации окна

- (void) applicationDidFinishLaunching: (UIApplication*) application 
{ 
    // Start in Landscape 
    [[UIApplication sharedApplication] setStatusBarOrientation:UIInterfaceOrientationLandscapeRight animated:NO]; 

    // Disable Auto Lock screen 
    [[UIApplication sharedApplication] setIdleTimerDisabled: YES]; 

    // Set Bounds with the proper screen resolution 
    CGRect screenBounds = [[UIScreen mainScreen] bounds]; 
    screenBounds  = CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT); 

    // Create window and view controler 
    m_window   = [[UIWindow alloc] initWithFrame: screenBounds]; 
    m_window.backgroundColor = [UIColor redColor]; 

    // Create new view controller 
    pExternViewController  = [SvgzViewController alloc] ; 

    // Initialize view controler with all pointers set up 
    if([pExternViewController initWithFrame: screenBounds ] == nil) 
    { 
     assert(!"Failed to initialize screen"); 
     exit(0); 
    } 

    // Rotate the window 
    [m_window setTransform:CGAffineTransformMakeRotation(M_PI/2.0f)]; 

    // Set the proper window center after transformation 
    m_window.center   = CGPointMake(screenBounds.size.height/2, screenBounds.size.width/2); 

    // Add GL window 
    [m_window addSubview: pExternViewController]; 

    // 
    [m_window makeKeyAndVisible]; 

} 

По крайней мере, не на стороне GL изменения должно быть сделано, делая это таким образом.