问题描述
我正在使用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 $ c的视图方法$ c>
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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!