tvOS (TVML): custom UIView in TVML

266 views Asked by At

I'm trying to use a custom UIView by registering a template:

TVElementFactory.registerViewElementClass(TVViewElement.self, elementName: "view1")

i then override the makeView TVInterfaceCreating protocol method:

func makeView(element: TVViewElement, existingView: UIView?) -> UIView? {

        switch element.name {

        case "view1":
            let view = View1()
            view.frame = CGRect(x: 0.0, y: 0.0, width: 100.0, height: 50.0)
            return view

        default:
            return nil
        }
    }

My Javascript file is as follows:

<document>
     <divTemplate>
          <view1></view1>
     </divTemplate>
</document>

But i get an empty view. Nothing is displayed!

How do i go about my custom UIView in TVML?

0

There are 0 answers