tvos - Set size (bounds) of TVApllicationController

52 Views Asked by At

Is there any way to resize the TVApplicationController. I want to include my TVML app inside a subview of a native ViewController.

My code:

var window: UIWindow?
var appController: TVApplicationController?
var appControllerContext = TVApplicationControllerContext();
static let TVBaseURL = "http://localhost:9001/"
static let TVBootURL = "\(StickyAdsNovaTVController.TVBaseURL)/client/js/application.js"

override func viewDidLoad() {
    super.viewDidLoad()

    window = UIWindow(frame: CGRect(x: 20, y: 20, width: 90, height: 60))

    guard let javaScriptURL = NSURL(string: StickyAdsNovaTVController.TVBootURL) else {
        fatalError("unable to create NSURL")
    }
    appControllerContext.javaScriptApplicationURL = javaScriptURL
    appControllerContext.launchOptions["BASEURL"] = StickyAdsNovaTVController.TVBaseURL

    appController = TVApplicationController(context: appControllerContext, window: window,delegate: self)

}

I tried to set the window frame using CGRect. The x,y are applied but neither width nor height. The size of the TVML app is always the size of the UIScreen.

Any ideas?

0

There are 0 best solutions below