Skip to content
Guillaume Gendre edited this page Jun 21, 2019 · 2 revisions

This file is required to specify the views of a cobalt application, if you don't want to use the default one everywhere.

This is a JSON file that contains one key per view in a 'controllers' array. A view is basically a controller and some options for the different platforms.

Quick example

{
    "controllers": {
        "default": {
            "ios": "ViewController",
            "iosNib": "ViewControllerNib",
            "android": ".MyActivity",
            "pullToRefresh" : true
        },
        "myVideoController": {
            "ios": "MyVideoViewController",
            "android": "com.example.myApplication.MyVideoActivity"
        }
    }
}

Controllers

Each view, named here "controller" is defined by a few keys :

  • android (optional): The name of the Android Activity to use. You can set the full package name like com.example.myApp.myActivity or use the . shortcut to start from your app package. Default is org.cobaltians.CobaltActivity.

  • ios (optional): The name of the iOS Controller to use. Default is CobaltViewController.

  • iosNib (for iOS, optional): The name of the .xib file to use with the class name defined in ios'. Default is the same name as the ios.

  • iosScrollToTop (for iOS, optional) : On iOS, you can tap on the status bar to scroll to the top of the webview. Setting this to false disable the feature. Default is true.

  • backgroundColor (optional) : The background color of the native webview. This background is visible (quickly) when the webview is loading, and when the user does a pulToRefresh on iOS. Default depends on your app native styles. See supported colors at Cobalt Colors page.

  • pullToRefresh (optional): If set to true, a pullToRefresh is added to the webview. Default is false. Read more about pull to refresh here

  • infiniteScroll (optional) : If set to true, a pullToRefresh is added to the webview. Default is false. Read more about infinite scroll here

the default key

The default key allows you to specify the controller and options to use if a navigation call is made without specifying a controller name, or when the specified controller is not found.

Where do I put this file?

This file have to be in the root directory of your "www" folder.

Clone this wiki locally