【发布时间】:2011-03-14 10:00:50
【问题描述】:
我正在尝试在横向视图中开发屏幕方向。
在我的应用程序中,我以纵向视图完成,但我也尝试像横向视图一样查看。
谁能帮我解决我的问题。在 iphone 中以编程方式在横向视图中的屏幕方向
提前谢谢你
【问题讨论】:
标签: iphone
我正在尝试在横向视图中开发屏幕方向。
在我的应用程序中,我以纵向视图完成,但我也尝试像横向视图一样查看。
谁能帮我解决我的问题。在 iphone 中以编程方式在横向视图中的屏幕方向
提前谢谢你
【问题讨论】:
标签: iphone
试试这个:
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
return YES
}
【讨论】:
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
return YES;
}
【讨论】:
- (void) applicationDidFinishLaunching: (UIApplication*) application
{
CGRect screenBounds = [[UIScreen mainScreen] bounds];
m_window = [[UIWindow alloc] initWithFrame: screenBounds];
viewController = [[MYViewController alloc] init];
[m_window addSubview:viewController.view];
[m_window makeKeyAndVisible];
}
- (BOOL)shouldAutorotateToInterfaceOrientation: (UIInterfaceOrientation)interfaceOrientation {
// Return YES for supported orientations
return ((interfaceOrientation == UIInterfaceOrientationLandscapeRight) );
}
在所有视图控制器中
在 info.plist 文件中设置键值
UIInterfaceOrientation UIInterfaceOrientationLandscapeRight
【讨论】:
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
return YES
}
确保您已为要显示的视图设置自动调整大小属性。
【讨论】: