繁体   English   中英

HTML应用程序横向

[英]HTML app Landscape Orientation

我已经搜寻了几个小时来寻找问题的答案,却没有发现任何可行的方法。 因此,如果这个问题已经得到回答,请接受我的歉意。

我对应用程序开发非常陌生,建议使用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解决方案?

我知道这是一个“小问题”,可能会有多个答案。 有人可以提供任何帮助或指示,我将不胜感激。

如果已经解决了这个问题,正如我对一个重复的问题说的很抱歉,但是有很多类似的问题,很难一一解决!

提前致谢!

我注意到一些人已经看过了。 我设法找到了问题的答案,并希望将其发布,以防万一其他人遇到类似的问题。

要获取以HTML编写的应用程序的内容以横向模式显示,您需要转到(以xcode表示)Folder(应用程序名称)->类-> 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);
}

那应该工作:-)

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM