Game center login lock in landscape only in i OS 6

前端 未结 2 1860
北海茫月
北海茫月 2020-12-08 15:48

When Game center is loaded its default orientation is portrait. In order to lock it in landscape mode, added a category.

@implementation GKMatchmakerViewCo         


        
相关标签:
2条回答
  • 2020-12-08 16:11

    At last i avoided crash by following the workaround mentioned in Apple's iOS 6 release notes.

    Workaround:

    1.Apps should provide the delegate method application:supportedIntefaceOrientationsForWindow and ensure that portrait is one of the returned mask values.

    - (NSUInteger)application:(UIApplication*)application supportedInterfaceOrientationsForWindow:(UIWindow*)window
    {
    
        return UIInterfaceOrientationMaskAllButUpsideDown;
    }
    

    2. When a UIBNavigationController (or a UIViewController) is involved, subclass the UINavigationController/UIViewController and overriding supportedInterfaceOrientations.

     - (NSUInteger)supportedInterfaceOrientations
        {
            return UIInterfaceOrientationMaskLandscape;
        }
    

    And

    In buid summary supported orientations selected landscape right and landscape left.

    Now game center is working properly without crash.

    0 讨论(0)
  • 2020-12-08 16:22

    Have to add 1 little thing. Struggling with that stupid issue about 2 days. If above doesn't help and you have UINavigationController invovled (and you already did subclass it) you need the following (in appDelegate):

    [window setRootViewController:navigationController]; // use this
    // instead of [self.window addSubview:navigationController.view];
    

    thanx 2 http://grembe.wordpress.com/2012/09/19/here-is-what-i/

    0 讨论(0)
提交回复
热议问题