Search code examples
objective-ctvosapple-tv

Unable to mimic Corner Taps of Siri remote in my game UI for Apple TV


Currently I am porting my Ios Game to AppleTV but for some reason I just could't get corner edge taps of the siri remote to work in my game.

I have a CustomViewController inside my Xib file and I created 2 buttons inside the view as a Outlet collections basically like this:

@property (retain, nonatomic) IBOutletCollection(UIButton) NSArray *Button;

But when I tap Left and right corners of the siri remote the focus is not changing instead it defaulted to the first button as a preferredfocusview. Ideally I would like it to change the focus when I tap the corners of the touch surface.

I have create a sample application but here instead of Xib files I used StoryBoards and the above theory worked as intended with the exact same procedure. enter image description here

As you can see in those images exactly what I have do so far. Can any body explain me what am I doing wrong please? and why the taps are working only for StoryBoards and not for Xib files.


Solution

  • Okay I found the solution for my problem, Here the issue was with Xib files and trying to use siri's focus api for up,down,left and right taps(not swipes). No matter how much I tried to hack it to make them functional the end result was nothing.

    So I moved all my Xib's functionality to StoryBoard and voila! every thing started working. So, as far as I know and according to my research we should use Storyboards to get full functionality of the TvOS features that includes Siri Remote as well. Here is what I did in my interface Builder enter image description here

    UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:[NSBundle mainBundle]];
        _viewController =[storyboard instantiateInitialViewController];