when i am adding new view to replace viewcontroller's view like this :
let viewcontroller: UIViewController!
let rootview:UIView!
viewcontroller = UIViewController ()
rootview = UIView (frame:viewcontroller.view.bounds)
viewcontroller.view = rootview
// Adding a button
let button = UIButton(type: .system)
button.setTitle("Tap Me", for: .normal)
button.titleLabel?.font = UIFont.systemFont(ofSize: 18)
button.addTarget(self, action: #selector(buttonTapped), for:.allEvents)
viewcontroller.view.addSubview(button)
For ios(iPhone/ipad) , i am able to get button click event . But in case of tvOS , i am not getting button click event.
But in case of tvOS if use the default view of viewcontroller like this , i am getting button click events and things works fine:
let viewcontroller: UIViewController!
viewcontroller = UIViewController ()
// Adding a button
let button = UIButton(type: .system)
button.setTitle("Tap Me", for: .normal)
button.titleLabel?.font = UIFont.systemFont(ofSize: 18)
button.addTarget(self, action: #selector(buttonTapped), for:.allEvents)
viewcontroller.view.addSubview(button)
Is this some bug for tvOS or for tvOS this suppose to happen this way ?