【问题标题】:How can i change the start page of Phonegap app in ios?如何在 ios 中更改 Phonegap 应用程序的起始页?
【发布时间】:2014-12-08 11:09:05
【问题描述】:

您好,请告诉我如何将 xcode 中的加载类(如 index.html)更改为 ios 中的 login.html。我是ios新手,请帮帮我。

【问题讨论】:

    标签: ios cordova


    【解决方案1】:

    这样做的正确方法是在不更改代码的情况下更改 config.xml 中的这一行

    <content src="index.html"/>
    

    <content src="login.html"/>
    

    【讨论】:

      【解决方案2】:

      我做的最简单的方法是,xxxViewController: CDVViewController<...>

      然后你可以写在'init'或'viewDidLoad'上

      - (id)init{
          self = [super init];
          if(self){
              self.wwwFolderName = @"dist/view";
              self.startPage = @"test.html";
          }
          return self;
      }
      

      -(void) viewDidLoad{
          self.wwwFolderName = @"dist/view";
          self.startPage = @"test.html";
          [super viewDidLoad];
      }
      

      所以,就是这样。

      【讨论】:

      • 太棒了!!!从那以后我一直在寻找这个解决方案......非常感谢
      【解决方案3】:

      以下代码将在您的项目文件夹中加载一个名为 index.html 的 HTML 文件:

      [WebView loadRequest:[NSURLRequest requestWithURL:[NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"index" ofType:@"html"]isDirectory:NO]]];
      

      【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-02-24
      • 1970-01-01
      • 1970-01-01
      • 2013-10-11
      • 2014-05-01
      • 2013-07-29
      相关资源
      最近更新 更多