你好我想提供屏幕方向在我的应用程序,我看了很多网上的文档,但是当我尝试,它只是一个彻头彻尾的灾难(我试过仿真器和iPhone)。在屏幕旋转到一半时,一部分视图不再可见。他们的立场是在左侧和右侧是空的,再加上如果我打开下一个视图控制器,然后再次旋转,我可以通过第一视图的第二视图部分看到它仅仅是可怕的,我不知道如何解决它(不包括阻止锁定肖像方向的可能性)。 我知道在Android中,您可以为纵向和横向提供不同的xml布局。有没有办法让iPhone在iPhone?如果是这样如何?iphone屏幕方向
我的每一个观点由一个控制器和的.xib 有一个“主”控制器和其他控制器被称为这样的:
ayuda=[[AyudaView alloc]
initWithNibName:@"AyudaView"
bundle:nil];
[self.view addSubview:ayuda.view];
还我已经添加了这些metods到maincontroller :
- (void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
UIDeviceOrientation orientation = [[UIDevice currentDevice] orientation];
if(UIDeviceOrientationIsValidInterfaceOrientation(orientation)) {
[self handleInterfaceRotationForOrientation:orientation];
}
}
#pragma mark -
#pragma mark Screen Orientation Handling
- (void)handleInterfaceRotationForOrientation:(UIInterfaceOrientation)interfaceOrientation {
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
[self handleInterfaceRotationForOrientation:interfaceOrientation];
return YES;
}
- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration {
[self handleInterfaceRotationForOrientation:toInterfaceOrientation];
}
指示here ,并试图与自动调整大小参数去发挥,但它只能越来越糟
非常感谢您
编辑:确定我一直在阅读一些:
http://www.geckogeek.fr/iphone-forcer-le-mode-landscape-ou-portrait-en-cours-dexecution.html
,基本上我所发现的是,你必须创建2个控制器,但这由于nib文件,解决方案对我来说是有问题的。我的意思是我还必须创建2个笔尖,使代码量增加一倍(或者使用上面的库)。如果我在我的文本字段中有值,我只需要发送它们呢?
你几乎不知道事情应该如何工作,因此如果没有引导你完成整个解决方案,问题是不可能回答的。而堆栈溢出并不意味着要这样工作。我建议你谷歌一些可可界面方向教程,并慢慢通过它,从简单的案件进展到更复杂的。 – zoul 2012-02-08 12:41:33
您是否阅读过与此相关的Apple文档? – 2012-02-08 12:44:40