HTML应用程序横向方向

时间:2012-03-22 17:02:44

标签: javascript jquery html xcode cordova

我已经搜索了几个小时来回答我的问题并找不到任何似乎有效的方法。如果这个问题已经得到解答,请接受我的道歉......

我是应用程序开发的新手,并建议使用XCODE和PhoneGap构建和编译html,css,jquery。 经过大量的努力,我已经设法构建了一个html页面并通过XCODE进行测试。

我的问题是我无法强制定位到风景。

我找到了在.plist文件中设置方向的答案。这会更改工具栏和查看窗口的方向,但内容(HTML)将保持纵向模式。

我找到了一个示例帖子,其中某人只在横向模式下创建了一个测试应用程序,我想很棒,但不幸的是,这是在客观C中。

例如,这是一个名为ViewA.m

的文件
    // ViewA.m

#import "ViewA.h"

@implementation ViewA

-(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
    {
    return (interfaceOrientation == UIInterfaceOrientationLandscapeRight);
    }

-(void)viewDidLoad
    {
//  self.view.frame = CGRectMake(0.0, 0.0, 1024.0, 768.0);
    [super viewDidLoad];
    }

@end

这些单独的文件是否适用于HTML和Objective C? 是否有针对html应用程序的jquery / javascript解决方案?

我感谢这是一个“有点”的问题,可能有多个答案。如果有人能提供任何帮助或指导,我将不胜感激。

如果这已经解决了,正如我为重复的问题所说的那样,但是有很多类似的问题,很难全部解决这些问题!

提前致谢!

1 个答案:

答案 0 :(得分:0)

我注意到有几个人看了。我已经设法找到我的问题的答案,并想发布它,只是因为其他人有类似的问题。

要使用HTML编写的应用内容以横向模式显示,您需要(在xcode中) 文件夹(app name) - >课程 - > MainViewController.m

你会看到:

    - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    // Return YES for supported orientations
    return (interfaceOrientation == UIInterfaceOrientationPortrait);
}

将此更改为

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    // Return YES for supported orientations
    return (interfaceOrientation == UIInterfaceOrientationLandscapeRight);
}

这应该有效: - )

相关问题