我的应用程序非常简单,但在启动时我遇到了一些问题。我在Info.plist中设置了美化环境,但它似乎忽略了订单。事实上,当应用程序加载时,仿真器是美化的,但它在纵向模式下返回。
这是视图和控制器的层次结构:
如果我强迫设备的方向去景观,用:
[UIDevice currentDevice setOrientation: UIInterfaceOrientationLandscapeRight];
然后在一个瞬间的模拟器闪烁在肖像模式,然后它去美化。问题是这样,自动旋转动画就开始了,这是我不能说的。我只想要一个固定的,美化的应用程序。
有什么线索吗?我是不是遗漏了什么?
发布于 2009-07-17 08:11:35
试试看以下几点。不知道为什么对你不起作用
1)设置密钥UIInterfaceOrientation
到UIInterfaceOrientationLandscapeRight文件中的.plist文件
2)重写您的UITabBarController shouldAutorotateToInterfaceOrientation()方法;在下面的代码中,只处理制表符0和一个,并且只处理一个控制器:如果您有一个导航控制器,并且希望控制堆栈上的不同控制器,则必须相应地修改代码。
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
BOOL tabZeroController = [[[self.viewControllers objectAtIndex:0] visibleViewController] isKindOfClass:[YourTabZeroTableViewController class]];
BOOL tabOneController = [[[self.viewControllers objectAtIndex:1] visibleViewController] isKindOfClass:[YourTabOneTableViewController class]];
if(self.selectedIndex == 0 && tabZeroController)
return (interfaceOrientation == UIInterfaceOrientationLandscapeRight);
if(self.selectedIndex == 1 && tabOneController)
return (interfaceOrientation == UIInterfaceOrientationLandscapeRight);
return NO;
}2)设定
[[UIDevice currentDevice] setOrientation:UIInterfaceOrientationLandscapeRight];在委托的applicationDidFinishLaunching()方法中,只需要模拟器,而不是设备上。
3)在控制器中添加以下shouldAutorotateToInterfaceOrientation(method)
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return (interfaceOrientation == UIInterfaceOrientationLandscapeRight);
}4)在您的设备上运行应用程序,并通过使用硬件菜单项,向左旋转和向右旋转来验证它是否正常工作。您应该在景观模式下看到显示。
发布于 2010-03-24 15:02:01
也许这能帮到http://www.dejoware.com/blogpages/files/iphone_programming_landscape_view_tutorial.html
https://stackoverflow.com/questions/1140914
复制相似问题