【发布时间】:2010-04-17 13:26:19
【问题描述】:
在我的应用程序中,我有 15 个屏幕。因为我对所有屏幕使用UIViewController,在所有屏幕中我使用以下方式调用其他屏幕:
AppDelegate *appRefre = (AppDelegate *)[[UIApplication sharedApplication]delegate];
[self.navigationController pushViewController:appRefre.frmReferencesLink animated:YES];
下面的代码在所有屏幕中被激活以控制用户从一个方向切换到另一种模式
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
if (interfaceOrientation == UIInterfaceOrientationPortrait)
{
return YES;
}
else
{
return NO;
}
}
但是当我在 iPhone 设备上运行我的应用程序时,当我将我的 iPhone 设备从 UIInterfaceOrientationPortrait 物理旋转到 UIInterfaceOrientationPortraitUpsideDown 或 UIInterfaceOrientationLandscapeLeft,UIInterfaceOrientationLandscapeRight 时,我的应用程序会终止。
还有一件事是,当我的应用程序启动时,我使用以下代码来启动我的应用程序:
1) 我在 mydelegate.h 文件中做了一个指针:
UINavigationController *navigationController;
然后合成它的属性
@property(nonatomic,retain)UINavigationController *navigationController;
2) 在 mydelegate.m 中 我写了
@synthesize navigationController;
- (void)applicationDidFinishLaunching:(UIApplication *)application
{
navigationController = [[UINavigationController alloc] initWithRootViewController:DefaultViewLink];
[window addSubview:navigationController.view];
[window makeKeyAndVisible];
}
3) 在上面的点中,DefaultView 首先启动并从视图中删除,然后实际我的应用程序进入图片。
所以我希望我的应用程序在所有屏幕上都处于纵向模式我不希望我的应用程序切换到其他模式。它在旋转到任何其他模式后保持与纵向模式相同。
【问题讨论】:
标签: iphone