本文介绍了横向模式下的FbGraph API的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用FbGraph API进行facebook集成。
一切正常,但问题是FbGraph API在横向视图中不会旋转。

I am using FbGraph API for facebook integration.Everything is working fine, but the problem is that the FbGraph API does not rotate in landscape view.

我还使用了 shouldAutorotateToInterfaceOrientation 为YES,我试图在 didRotateFromInterfaceOrientation 中设置一个断点。

I also used the shouldAutorotateToInterfaceOrientation to YES, and i tried to put a breakpoint in didRotateFromInterfaceOrientation.

它是永远不会被召唤
我真的很喜欢这个。
请帮助

It is never being called.I am really stuck into this.pls help

推荐答案

我在下面使用它的工作正常,

I use below and its work fine,

1)在中发布通知 - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation 使用 FBGraph

2)

- (BOOL)shouldAutorotateToInterfaceOrientation (UIInterfaceOrientation)interfaceOrientation
{

     [[NSNotificationCenter defaultCenter] postNotification:[NSNotification notificationWithName:@"CHANGE_ORIENTATION" object:orientation]];

}

3)在 FBGraph

-(void)authenticateUserWithCallbackObject:(id)anObject andSelector:(SEL)selector andExtendedPermissions:(NSString *)extended_permissions {

    NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
    [nc addObserver:self selector:@selector(shouldAutorotateToInterfaceOrientation:)
               name:@"CHANGE_ORIENTATION"
             object:nil];
   -----------
 -------
}

-(BOOL)shouldAutorotateToInterfaceOrientation:(NSNotification *)notofication

{

    if([notofication.object isEqualToString:@"LEFT"])
    {
        CGAffineTransform newTransform;
        newTransform = CGAffineTransformMakeRotation(M_PI * 270 / 180.0f);
        webView.transform = newTransform;
        [webView setFrame:CGRectMake(12, 0, 320, 480)];
        NSLog(@"LEFT");
    }
    else if([notofication.object isEqualToString:@"RIGHT"])
    {
        CGAffineTransform newTransform;
        newTransform = CGAffineTransformMakeRotation(M_PI * 90 / 180.0f);
        webView.transform = newTransform;
            [webView setFrame:CGRectMake(0, 0, 305, 480)];
        NSLog(@"RIGHT");
    }
    else if([notofication.object isEqualToString:@"PORTRAIT"])
    {
        CGAffineTransform newTransform;
        newTransform = CGAffineTransformMakeRotation(M_PI * 360 / 180.0f);
        webView.transform = newTransform;
            [webView setFrame:CGRectMake(0, 12, 320, 480)];
        NSLog(@"PORTRAIT");
    }
    else if([notofication.object isEqualToString:@"DOWN"])
    {
        CGAffineTransform newTransform;
        newTransform = CGAffineTransformMakeRotation(M_PI * 180 / 180.0f);
        webView.transform = newTransform;
            [webView setFrame:CGRectMake(0, 0, 320, 465)];
        NSLog(@"DOWN");
    }
    return YES;
}

这篇关于横向模式下的FbGraph API的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

06-23 07:11