Iphone tabbarcontroller的纵向模式定向问题?
使用tabbarcontroller,shouldAutorotateToInterfaceOrientation:方法不调用纵向模式,而对于其他三个方向,它的调用是完美的。有人知道这件事吗Iphone tabbarcontroller的纵向模式定向问题?,iphone,uitabbarcontroller,Iphone,Uitabbarcontroller,使用tabbarcontroller,shouldAutorotateToInterfaceOrientation:方法不调用纵向模式,而对于其他三个方向,它的调用是完美的。有人知道这件事吗 谢谢您尝试过设备和模拟器吗? 你是否在你的应用程序\u name-Info.plist中检查了支持的方向?即使是我也遇到了这个问题,如果你只是想知道设备的方向是否已更改,请使用通知而不是应该使用AutoRotateTointerFaceOrientation [[NSNotificationCenter d
谢谢您尝试过设备和模拟器吗?
你是否在你的应用程序\u name-Info.plist中检查了支持的方向?即使是我也遇到了这个问题,如果你只是想知道设备的方向是否已更改,请使用通知而不是应该使用AutoRotateTointerFaceOrientation
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(orientationChanged:) name:UIDeviceOrientationDidChangeNotification object:nil];
-(void)orientationChanged:(NSNotification *)dict
{
UIInterfaceOrientation interfaceOrientation = (UIInterfaceOrientation)[UIDevice currentDevice].orientation;
//Your code
}
对于原始问题,默认情况下,shouldAutorotateToInterfaceOrientation为UIDeviceOrientationGraphital返回YES,如果在shouldAutorotateToInterfaceOrientation方法中返回NO,设备将认为其仅处于UIDeviceOrientationGrait模式,因此不应为UIDeviceOrientationGrait调用方法AutoRotateTointerFaceOrientation
没有足够的信息。你应该把代码贴在发生这种情况的地方。我两个都试过了。同样的结果。在.plist中,我没有更改或限制任何内容?我很奇怪,你确定在plist文件中没有“支持的接口方向”键吗?当然。。与方向相关的螺母。您是否始终在shouldAutorotateToInterfaceOrientation方法中返回否。
(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation
{
//your code
return NO;
}